i want to add (add widget )button that when you click it , it pop up all default widgets to add in your own page , i know it is already implemented in profile and dashboard pages but i want to implement it inside my own designed page also
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.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- mohamed mohsen@momo_saleh
mohamed mohsen - 0 likes
function dashboard_init() { elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'dashboard_default_widgets'); } function dashboard_default_widgets(\Elgg\Hook $hook) { $return = $hook->getValue(); $return[] = [ 'name' => elgg_echo('dashboard'), 'widget_context' => 'dashboard', 'widget_columns' => 3, 'event' => 'create', 'entity_type' => 'user', 'entity_subtype' => ELGG_ENTITIES_ANY_VALUE, ]; return $return; } return function() { elgg_register_event_handler('init', 'system', 'dashboard_init'); }; but it turned out it just add new configuration tab in configure => utilites=> default widget for my new page in admin page to add deafult widgets in user page without his interface by default . but how i add the add widget menu or button with the gear icon in my new page like happening in dashboard page or profile page till now i donot know
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
You must log in to post replies.Look at this code.
Perhaps, you want to learn docs.
it didnot work for me can you try it ? it is very confusing i found this code :-
if you draw a 'widget' layout (like done in https://github.com/Elgg/Elgg/blob/a836dda6e17954f8825c728d69b6113e38a01332/mod/dashboard/views/default/resources/dashboard.php#L5-L11) the function 'elgg_can_edit_widget_layout()' is called which triggers a hook to allow users to add widgets when the function returns TRUE.
See https://github.com/Elgg/Elgg/blob/a836dda6e17954f8825c728d69b6113e38a01332/engine/lib/widgets.php#L39-L52