diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2008-11-27 06:25:21 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-27 06:25:21 +0000 |
| commit | 3992dad4861c3a1296be7e0e7d4c7a46d621c1cc (patch) | |
| tree | d67dbf4933c5b87ce2da653fecf658fef9277815 /modules/tag/helpers | |
| parent | 09b27ecf9871db0bfeb7043cf8e667b66e56185a (diff) | |
Move form generation off into tag::get_add_form(). We can't use a controller to generate the form (it's incompatible with our REST model where controllers print stuff)
Diffstat (limited to 'modules/tag/helpers')
| -rw-r--r-- | modules/tag/helpers/tag.php | 10 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_block.php | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 23edc5f2..38595b1c 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -78,4 +78,14 @@ class tag_Core { return $cloud; } } + + public static function get_add_form($item_id) { + $form = new Forge(url::site("tags"), "", "post", array("id" => "gAddTag")); + $group = $form->group(_("Add Tag")); + $group->input("tag_name"); + $group->hidden("item_id")->value($item_id); + $group->submit(_("Add")); + $form->add_rules_from(ORM::factory("tag")); + return $form; + } } diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 02a536ad..2a9a25aa 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -32,7 +32,7 @@ class tag_block_Core { if ($theme->page_type() != "tag") { $controller = new Tags_Controller(); - $block->content->form = $controller->form_add($theme->item()); + $block->content->form = tag::get_add_form($theme->item()); } else { $block->content->form = ""; } |
