Elgg  Version 2.3
start.php
Go to the documentation of this file.
1 <?php
6 elgg_register_event_handler('init', 'system', 'my_plugin_init');
7 
8 function my_plugin_init() {
9  // Rename this function based on the name of your plugin and update the
10  // elgg_register_event_handler() call accordingly
11 
12  // Register a script to handle (usually) a POST request (an action)
13  $base_dir = __DIR__ . '/actions/my_plugin';
14  elgg_register_action('my_plugin', "$base_dir/my_action.php");
15 
16  // Extend the main CSS file
17  elgg_extend_view('elgg.css', 'my_plugin.css');
18 
19  // Require your JavaScript AMD module (view "my_plugin.js") on every page
20  elgg_require_js('my_plugin');
21 
22  // Add a menu item to the main site menu
23  $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
25 }
my_plugin_init()
Definition: start.php:8
if(!$items) $item
Definition: delete.php:17
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
Definition: elgglib.php:232
elgg_extend_view($view, $view_extension, $priority=501)
Extends a view with another view.
Definition: views.php:380
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Definition: elgglib.php:550
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:96