Please correct me if I am doing anything wrong here.
1. Register the Entity in start.php
<?php
elgg_register_event_handler('init', 'system', 'my_blog_init');
/**
* Init blog plugin.
*/
function my_blog_init() {
elgg_register_library('elgg:my_blog', elgg_get_plugins_path() . 'bookmarks/lib/bookmarks.php');
}
2. Added the lib function in the lib/my_blog.php
function my_blog_prepare_form_vars($my_blog = null) {
echo "in lib";
$values = array(
'title' => get_input('title', ''), // bookmarklet support
'description' => '',
'tags' => '',
'tags2' => '',
'entity' => $my_blog,
);
......
}
3. Added the entry in views/object/my_blog.php
echo elgg_view('output/text', array('tags2' => $my_blog->tags2));
4. Add the entry in the form save.php
<div>
<label><?php echo elgg_echo("tags2"); ?></label><br />
<?php echo elgg_view('input/text', array('name' => 'tags2')); ?>
</div>
5. Added the following in the pages folder ( pages/my_blog/add.php)
$vars = my_blog_prepare_form_vars();
echo "vars = ".$vars;
// add the form to this section
$content .= elgg_view_form("my_blog/save" , array(), $vars);
6. Added the following in actions ( actions/my_blog/save.php)
$tags2 = get_input('tags2');
$my_blog->tags2 = $tags2; ( I cannot access tags2 here: tags2 not found in the Elgg Object).
Not very clear on the life cycle or the process flow. Is there any good reference in understanding the process flow and any pointers on the above as to what is wrong?
Any help is really appreciated.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.