danielebarchiesi@0: 'CTools plugin example', danielebarchiesi@0: 'description' => t("Demonstration code, advanced help, and a demo panel to show how to build ctools plugins."), danielebarchiesi@0: 'page callback' => 'ctools_plugin_example_explanation_page', danielebarchiesi@0: 'access arguments' => array('administer site configuration'), danielebarchiesi@0: 'type' => MENU_NORMAL_ITEM, danielebarchiesi@0: ); danielebarchiesi@0: danielebarchiesi@0: return $items; danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Implements hook_ctools_plugin_directory(). danielebarchiesi@0: * danielebarchiesi@0: * It simply tells panels where to find the .inc files that define various danielebarchiesi@0: * args, contexts, content_types. In this case the subdirectories of danielebarchiesi@0: * ctools_plugin_example/panels are used. danielebarchiesi@0: */ danielebarchiesi@0: function ctools_plugin_example_ctools_plugin_directory($module, $plugin) { danielebarchiesi@0: if ($module == 'ctools' && !empty($plugin)) { danielebarchiesi@0: return "plugins/$plugin"; danielebarchiesi@0: } danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Implement hook_ctools_plugin_api(). danielebarchiesi@0: * danielebarchiesi@0: * If you do this, CTools will pick up default panels pages in danielebarchiesi@0: * .pages_default.inc danielebarchiesi@0: */ danielebarchiesi@0: function ctools_plugin_example_ctools_plugin_api($module, $api) { danielebarchiesi@0: // @todo -- this example should explain how to put it in a different file. danielebarchiesi@0: if ($module == 'panels_mini' && $api == 'panels_default') { danielebarchiesi@0: return array('version' => 1); danielebarchiesi@0: } danielebarchiesi@0: if ($module == 'page_manager' && $api == 'pages_default') { danielebarchiesi@0: return array('version' => 1); danielebarchiesi@0: } danielebarchiesi@0: } danielebarchiesi@0: danielebarchiesi@0: /** danielebarchiesi@0: * Just provide an explanation page for the admin section danielebarchiesi@0: * @return unknown_type danielebarchiesi@0: */ danielebarchiesi@0: function ctools_plugin_example_explanation_page() { danielebarchiesi@0: $content = '

' . t("The CTools Plugin Example is simply a developer's demo of how to create plugins for CTools. It provides no useful functionality for an ordinary user.") . '

'; danielebarchiesi@0: danielebarchiesi@0: $content .= '

' . t( danielebarchiesi@0: 'There is a demo panel demonstrating much of the functionality provided at danielebarchiesi@0: CTools demo panel, and you can find documentation on the examples at danielebarchiesi@0: !ctools_plugin_example_help. danielebarchiesi@0: CTools itself provides documentation at !ctools_help. Mostly, though, the code itself is intended to be the teacher. danielebarchiesi@0: You can find it in %path.', danielebarchiesi@0: array( danielebarchiesi@0: '@demo_url' => url('ctools_plugin_example/xxxxx'), danielebarchiesi@0: '!ctools_plugin_example_help' => theme('advanced_help_topic', array('module' => 'ctools_plugin_example', 'topic' => 'Chaos-Tools--CTools--Plugin-Examples', 'type' => 'title')), danielebarchiesi@0: '!ctools_help' => theme('advanced_help_topic', array('module' => 'ctools', 'topic' => 'plugins', 'type' => 'title')), danielebarchiesi@0: '%path' => drupal_get_path('module', 'ctools_plugin_example'), danielebarchiesi@0: )) . '

'; danielebarchiesi@0: danielebarchiesi@0: return $content; danielebarchiesi@0: }