From 1.7 to 1.8
Elgg 1.8 is the biggest leap forward in the development of Elgg since version 1.0. As such, there is more work to update core and plugins than with previous upgrades. There were a small number of API changes and following our standard practice, the methods we deprecated have been updated to work with the new API. The biggest changes are in the standardization of plugins and in the views system.
Delete the following core directories (same level as _graphics and engine):
If you do not delete these directories before an upgrade, you will have problems!
Use standardized routing with page handlers
User’s content: /page_handler/owner/:username
User’s friends” content: /page_handler/friends/:username
Single entity: /page_handler/view/:guid/:title
Group list: /page_handler/group/:guid/all
Include page handler scripts from the page handler
Almost every page handler should have a page handler script.
bookmarks/all => mod/bookmarks/pages/bookmarks/all.php)
set_input()for entity guids in the page handler and use
get_input()in the page handler scripts.
admin_gatekeeper()in the page handler function if required.
The group URL should use the
Page handlers should not contain HTML.
Update the URLs throughout the plugin. (Don’t forget to remove
Use standardized page handlers and scripts
Store page handler scripts in
Use the content page layout in page handler scripts:
$content = elgg_view_layout('content', $options);
Page handler scripts should not contain HTML.
elgg_push_breadcrumb()in the page handler scripts.
No need to set page owner if the URLs are in the standardized format.
For group content, check the container_guid by using elgg_get_page_owner_entity().
Make sure there are views for
$vars['full_view'] == trueand
$vars['full_view'] == false.
Check for the object in
elgg_instance_of()to make sure it’s the type of entity you want.
trueto short circuit the view if the entity is missing or wrong.
elgg_view('object/elements/summary', array('entity' => $entity));and
elgg_view_menu('entity', array('entity' => $entity));to help format. You should use very little markup in these views.
Update action structure
Namespace action files and action names (example:
Use the following action URLs:
Make the delete action accept
action/:handler/delete?guid=:guidso the metadata entity menu has the correct URL by default.
Update deprecated functions
Functions deprecated in 1.7 will produce visible errors in 1.8.
You can also update functions deprecated in 1.8.
Many registration functions simply added an
elgg_prefix for consistency, and should be easy to update.
/engine/lib/deprecated-1.8.phpfor the full list.
You can set the debug level to “warning” to get visual reminders of deprecated functions.
Update the widget views
See the blog or file widgets for examples.
Update the group profile module
Use the blog or file plugins for examples. This will help with making your plugin themeable by the new CSS framework.
Move form bodies to the
forms/:actionview to use Evan’s new
Use input views in form bodies rather than html. This helps with theming and future-proofing.
Add a function that prepares the form (see
mod/file/lib/file.phpfor an example)
Make your forms sticky (see the file plugin’s upload action and form prepare function).
The forms API is discussed in more detail in Forms + Actions.
Clean up CSS/HTML
We have added many CSS patterns to the base CSS file (modules, image block, spacing primitives). We encourage you to use these patterns and classes wherever possible. Doing so should:
Reduce maintenance costs, since you can delete most custom CSS.
Make your plugin more compatible with community themes.
Look for patterns that can be moved into core if you need significant CSS.
We use hyphens rather than underscores in classes/ids and encourage you do the same for consistency.
If you do need your own CSS, you should use your own namespace, rather than
Use http://el.gg/manifest17to18 to automate this.
Don’t use the «bundled» category with your plugins. That is only for plugins distributed with Elgg.
Update settings and user settings views
The view for settings is now
The view for user settings is now