start.php 817 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Describe plugin here
  4. */
  5. elgg_register_event_handler('init', 'system', 'my_plugin_init');
  6. function my_plugin_init() {
  7. // Rename this function based on the name of your plugin and update the
  8. // elgg_register_event_handler() call accordingly
  9. // Register a script to handle (usually) a POST request (an action)
  10. $base_dir = elgg_get_plugins_path() . 'my_plugin/actions/my_plugin';
  11. elgg_register_action('my_plugin', "$base_dir/my_action.php");
  12. // Extend the main CSS file
  13. elgg_extend_view('css/elgg', 'css/my_plugin.css');
  14. // Require your JavaScript AMD module (view "js/my_plugin.js") on every page
  15. elgg_require_js('my_plugin');
  16. // Add a menu item to the main site menu
  17. $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
  18. elgg_register_menu_item('site', $item);
  19. }