summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tag.php18
-rw-r--r--modules/tag/helpers/tag_block.php9
2 files changed, 12 insertions, 15 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 09109cd5..a1939df7 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -23,8 +23,9 @@ class tag_Core {
*
* @todo Write test.
*
- * @param ORM $item an item
- * @param string $tag_name a tag name
+ * @param Item_Model $item an item
+ * @param string $tag_name a tag name
+ * @return Tag_Model
* @throws Exception("@todo {$tag_name} WAS_NOT_ADDED_TO {$item->id}")
*/
public static function add($item, $tag_name) {
@@ -46,6 +47,7 @@ class tag_Core {
$tag->count++;
$tag->save();
}
+ return $tag;
}
/**
@@ -59,16 +61,4 @@ class tag_Core {
->limit($count)
->find_all();
}
-
- public static function get_add_form($item_id) {
- $form = new Forge(url::site("form/add/tags/$item_id"), "", "post", array("id" => "gAddTag"));
- $form->input("tags")
- ->label(_("(Enter tags separated by commas)"))
- ->id("gNewTags")
- ->class("text")
- ->value("add new tags...")
- ->rules("required");
- $form->submit(_("Add"));
- return $form;
- }
}
diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php
index 5cf6aa75..c735ee04 100644
--- a/modules/tag/helpers/tag_block.php
+++ b/modules/tag/helpers/tag_block.php
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
class tag_block_Core {
public static function head($theme) {
$url = url::file("modules/tag/js/tag.js");
@@ -39,7 +38,15 @@ class tag_block_Core {
if ($block->content->page_type != "tag") {
$block->content->item = $theme->item();
}
+ } else {
+ $block->content->tags = array();
+ }
+
+ if ($theme->page_type() != "tag") {
+ $controller = new Tags_Controller();
+ $block->content->form = $controller->form_add($theme->item());
}
+
return $block;
}