Hook Invokers


Detailed Description

Functions in this list invoke one of Panels' numerous hooks. This includes hooks provided by the Panels API itself, as well the client modules that are packaged with Panels.


Functions

 panels_get_include_directories ($plugin_type)
 panels_get_pane_content ($display, $pane, $args=array(), $context=NULL, $incoming_content= '')
 panels_load_displays ($dids)
 panels_load_hooks ($hook)
 panels_mini_default_panels ()
 panels_page_default_panels ()
 panels_render_display (&$display)
 panels_views_default_panels ()


Function Documentation

panels_get_include_directories ( plugin_type  ) 

Invocation of panels_include_directory(), part of the main panels API.

See also:
panels_panels_include_directory()
This hook allows other modules to create their own panels .inc files according to the same filename and directory schema utilized by Panels itself, or some other arbitrary schema defined in implementations of the hook. Essentially, instead of having to declare all all callback definitions for a given plugin in a single hook implementation specific to that plugin calling this hook allows the caller to define a directory where Panels will then look for .inc files with callback declarations that conform to the naming scheme. The net result is the same, but implementing this hook does allow for better organization and flexibility in your .inc files, which is particularly preferable if you're implementing a lot of them.

PLEASE NOTE: There are strict naming conventions on implementing this hook; failure to follow the conventions will likely cause your plugins not to work. Possibly even worse, failure to follow the conventions can result in namespace collisions between your module and other modules invoking the panels API.

Parameters:
string $plugintype The type of Panels plugin being requested. Can be any of the following seven: 'content_types', 'contexts', 'arguments', 'layouts', 'styles', 'relationships', 'cache', 'switchers'
Returns:
array $directories Returns an array of include subdirectories to call for the requested plugin type. Subdirectories should be ONLY the subdirectory of your module where the appropriate types of .inc files reside.

Definition at line 1380 of file plugins.inc.

Referenced by panels_load_includes().

01380                                                       {
01381   $directories = array();
01382   foreach (module_implements('panels_include_directory') as $module) {
01383     $result = module_invoke($module, 'panels_include_directory', $plugin_type);
01384     if (isset($result) && is_string($result)) {
01385       $directories[$module] = drupal_get_path('module', $module) .'/'. $result;
01386     }
01387   }
01388   return $directories;
01389 }

Here is the caller graph for this function:

panels_get_pane_content ( display,
pane,
args = array(),
context = NULL,
incoming_content = '' 
)

Get the content from a given pane.

Parameters:
$pane The pane to retrieve content from.
$args The arguments sent to the display.
$context The panels context.
$incoming_content Any incoming content if this display is a wrapper.

Definition at line 523 of file plugins.inc.

References panels_ct_get_content(), panels_get_cached_content(), and panels_set_cached_content().

Referenced by panels_render_pane_content().

00523                                                                                                             {
00524   if (!$context) {
00525     $context = new panels_context;
00526   }
00527   // FIXME misplaced bang?
00528   if (!$incoming_content === '') {
00529     $incoming_content = t('Incoming content will be displayed here.');
00530   }
00531 
00532   $content = FALSE;
00533   $caching = !empty($pane->cache['method']) ? TRUE : FALSE;
00534   if ($caching && ($cache = panels_get_cached_content($display, $args, $context, $pane))) {
00535     $content = $cache->content;
00536   }
00537   else {
00538     $content = panels_ct_get_content($pane->type, $pane->configuration, $args, $context, $incoming_content);
00539     foreach (module_implements('panels_pane_content_alter') as $module) {
00540       // TODO This makes the third hook invocation on the render path. How badly is this hindering performance?
00541       $function = $module . '_panels_pane_content_alter';
00542       $function($content, $pane, $args, $context);
00543     }
00544     if ($caching) {
00545       $cache = new panels_cache_object();
00546       $cache->set_content($content);
00547       panels_set_cached_content($cache, $display, $args, $context, $pane);
00548     }
00549   }
00550 
00551   return $content;
00552 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_load_displays ( dids  ) 

Load and fill the requested $display object(s).

Helper function primarily for for panels_load_display().

Parameters:
array $dids An indexed array of dids to be loaded from the database.
Returns:
$displays An array of displays, keyed by their display dids.

Definition at line 657 of file panels.module.

Referenced by panels_load_display(), panels_mini_list_page(), and panels_page_list_page().

00657                                      {
00658   $displays = array();
00659   if (empty($dids) || !is_array($dids)) {
00660     return $displays;
00661   }
00662 
00663   $subs = implode(', ', array_fill(0, count($dids), '%d'));
00664 
00665   $result = db_query("SELECT * FROM {panels_display} WHERE did IN ($subs)", $dids);
00666 
00667   while ($obj = db_fetch_array($result)) {
00668     $display = new panels_display();
00669 
00670     foreach ($obj as $key => $value) {
00671       $display->$key = $value;
00672       // unserialize important bits
00673       if (in_array($key, array('layout_settings', 'panel_settings', 'cache'))) {
00674         $display->$key = empty($display->$key) ? array() : unserialize($display->$key);
00675       }
00676     }
00677 
00678     $display->panels = $display->content = array();
00679 
00680     $displays[$display->did] = $display;
00681   }
00682 
00683   foreach (module_implements('panels_layout_content_alter') as $module) {
00684     $function = $module . '_panels_layout_content_alter';
00685     $function($content, $layout, $settings);
00686   }
00687 
00688   $result = db_query("SELECT * FROM {panels_pane} WHERE did IN ($subs) ORDER BY did, panel, position", $dids);
00689 
00690   while ($pane = db_fetch_object($result)) {
00691     $pane->configuration = unserialize($pane->configuration);
00692     $pane->cache = empty($pane->cache) ? array() : unserialize($pane->cache);
00693     $pane->access = ($pane->access ? explode(', ', $pane->access) : array());
00694     // Old panels may not have shown property, so enable by default when loading.
00695     $pane->shown = isset($pane->shown) ? $pane->shown : TRUE;
00696 
00697     $displays[$pane->did]->panels[$pane->panel][] = $pane->pid;
00698     $displays[$pane->did]->content[$pane->pid] = $pane;
00699   }
00700   return $displays;
00701 }

Here is the caller graph for this function:

panels_load_hooks ( hook  ) 

Load plugin info for the provided hook; this is handled separately from plugins from files.

IMPORTANT: The hooks invoked by this function do work, but it is _not_ the preferred method, as it is left up to the module invoking the hook to handle including separate .inc files with potentially unneeded functions - and there is no way for any entity external to the Panels engine to know if that inclusion is necessary. Consequently, hook_panels_include_directory() should be used unless some aspect of the client's implementation is incompatible with that approach.

See also:
panels_get_include_directories()
Parameters:
$hook The hook being invoked.
Returns:
An array of info supplied by any hook implementations.

Definition at line 1452 of file plugins.inc.

References _panels_process_plugin().

Referenced by panels_get_plugins().

01452                                   {
01453   $info = array();
01454   foreach (module_implements($hook) as $module) {
01455     $result = _panels_process_plugin($module, $module, drupal_get_path('module', $module), $hook);
01456     if (is_array($result)) {
01457       $info = array_merge($info, $result);
01458     }
01459   }
01460   return $info;
01461 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_mini_default_panels (  ) 

Get all 'default' mini panels.

Definition at line 1182 of file panels_mini.module.

Referenced by panels_mini_disable_page(), panels_mini_enable_page(), panels_mini_load(), and panels_mini_load_all().

01182                                       {
01183   $panels = module_invoke_all('default_panel_minis');
01184   if (!is_array($panels)) {
01185     $panels = array();
01186   }
01187 
01188   return $panels;
01189 }

Here is the caller graph for this function:

panels_page_default_panels (  ) 

Get all 'default' panels.

Definition at line 1101 of file panels_page.module.

Referenced by panels_page_disable_page(), panels_page_enable_page(), panels_page_load(), panels_page_load_all(), and panels_page_view_page().

01101                                       {
01102   $panels = module_invoke_all('default_panel_pages');
01103   if (!is_array($panels)) {
01104     $panels = array();
01105   }
01106 
01107   return $panels;
01108 }

Here is the caller graph for this function:

panels_render_display ( &$  display  ) 

Render a display by loading the content into an appropriate array and then passing through to panels_render_layout.

if $incoming_content is NULL, default content will be applied. Use an empty string to indicate no content.

Definition at line 912 of file panels.module.

References panels_get_layout(), panels_load_include(), panels_render_layout(), and panels_sanitize_display().

Referenced by panels_mini_block(), panels_mini_content(), panels_mini_preview_panel(), panels_node_view(), panels_page_view_page(), and theme_panels_page_render_form().

00912                                           {
00913   panels_load_include('plugins');
00914   $layout = panels_get_layout($display->layout);
00915   if (!$layout) {
00916     return NULL;
00917   }
00918 
00919   // TODO: This may not be necessary now. Check this.
00920   panels_sanitize_display($display);
00921 
00922   $output = '';
00923 
00924   // Let modules act just prior to render.
00925   foreach (module_implements('panels_pre_render') as $module) {
00926     $function = $module . '_panels_pre_render';
00927     $output .= $function($display);
00928   }
00929 
00930   $output .= panels_render_layout($layout, $display, $display->css_id, $display->layout_settings);
00931 
00932   // Let modules act just after render.
00933   foreach (module_implements('panels_post_render') as $module) {
00934     $function = $module . '_panels_post_render';
00935     $output .= $function($display);
00936   }
00937   return $output;
00938 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_views_default_panels (  ) 

Get all 'default' view panes.

Definition at line 1442 of file panels_views.module.

Referenced by panels_views_disable_page(), panels_views_enable_page(), panels_views_load(), and panels_views_load_all().

01442                                        {
01443   $panels = module_invoke_all('default_panel_views');
01444   if (!is_array($panels)) {
01445     $panels = array();
01446   }
01447 
01448   return $panels;
01449 }

Here is the caller graph for this function:


Generated on Sun Mar 14 05:00:22 2010 for Panels 2 by  doxygen 1.5.6