Resource views usually draw a page and call elgg_view_page(). You would use resource views in your page handler, calling elgg_view_resource(). As a general rule, you would only keep full page views in your resource views, everything else (partial views, components etc), should go elsewhere in the view directory.
Ismayil,
Thanks a lot for your explanation.
I finally figured out. I kept on going on circles why the following statement was never true when deleting the first field, which is id=0.
if ($id &&
unset_config("admin_defined_profile_$id") &&
unset_config("admin_defined_profile_type_$id") &&
elgg_save_config('profile_custom_fields', $fieldlist)) {
system_message(elgg_echo('profile:editdefault:delete:success'));
} else {
register_error(elgg_echo('profile:editdefault:delete:fail'));
}
Evaluating id for value zero is not evaluating as true but false or empty, in order to fix this it should be isset($id)
Now this brings up the question of whether this is a bug or was written like this on purpose not to allow users to delete the first field created.
Sounds like a bug, please report on github
Have you read http://learn.elgg.org/en/stable/guides/javascript.html? Have you looked into the code of Elgg core (compared the code of a recent version of Elgg using the elgg/thewire AMD module with an older version of Elgg not yet using it) to find out what changes have been made in the code of Elgg to switch from thewire.js to the elgg/thewire AMD module?
iionly,
Thank you. I was able to do. I had to modify elgg_load_js for elgg_require_js in an override I was doing in my plugin.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo} span.s1 {font-variant-ligatures: no-common-ligatures}
mod/my_plugin/views/default/object/thewire.php
Just because some JS is 'registered' doesn't mean it's being used. That's what 'elgg_load_js()' is for
Thank you. I learned how to unregister the js and load the register js using elgg_load_js. I noticed that the new versions of elgg are more inclined to use elgg_require_js.
Depending on what you are trying to do and what the module's output is.
You can either 1) replace the module's view with a module that does nothing, 2) require the module and overwrite it's value with your own.
Ismayil,
hahaha, no problem. I updated to 2.3.0. I will test again and let you know how did it go. Like always, thanks for your replies.
Ok, I finally had the opportunity to try it. I tried the first part of the code but I am getting the following error.
Call to a member function canEdit() on null in /usr/local/elgg/2.3.0/vendor/elgg/elgg/engine/lib/navigation.php on line 484
This is how I did it.
$p = array(
'entity' => $posts,
'handler' => 'thewire',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz', );
$old_menu = elgg()->menus->getMenu('entity', $p);
$sections = $old_menu->getSections();
foreach ($sections as $section => $items) {
foreach ($items as $item) {
elgg_register_menu_item('no_reply', $item);
// or in 2.3 you can inject items into elgg_view_menu()
$new_menu_items[] = $item;
}
}
echo elgg_view_menu('no_reply',[ 'items' => $new_menu_items, ]);
The hook method worked though.
I just remembered that the there is an option to combine menus somewhere in the menus API. Just dig through the code.
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.