Elgg  Version 1.9
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 = elgg_get_plugins_path() . 'my_plugin/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('css/elgg', 'my_plugin/css');
18 
19  // Add a menu item to the main site menu
20  $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
22 }
my_plugin_init()
Definition: start.php:8
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$item
Definition: item.php:12
elgg_extend_view($view, $view_extension, $priority=501, $viewtype= '')
Extends a view with another view.
Definition: views.php:401
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
Definition: navigation.php:73
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
Definition: elgglib.php:669
elgg_get_plugins_path()
Get the plugin path for this installation.
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:85