plugins.inc File Reference

(1.1.2.55 2008/11/12 19:58:57 sdboyer)


Detailed Description

Contains helper code for plugins and contexts.

Definition in file plugins.inc.

Go to the source code of this file.

Classes

class  panels_cache_object
class  panels_context
class  panels_optional_context
class  panels_required_context

Functions

 _panels_context_filter ($contexts, $required)
 _panels_context_select ($contexts, $required, $context)
 _panels_context_selector ($contexts, $required, $default, $num=0)
 _panels_pane_access_role ($pane, $account)
 _panels_process_plugin ($module, $identifier, $path, $hook)
 panels_argument_choose_display ($type, $conf, $context)
 panels_argument_context_id ($argument)
 panels_argument_get_context ($argument, $arg, $empty=FALSE)
 panels_argument_get_contexts ($arguments)
 panels_argument_get_display ($arguments, $contexts)
 panels_argument_load_contexts ($arguments, &$contexts, $args)
 panels_clear_cached_content ($display)
 panels_context_context_id ($context, $type= 'context')
 panels_context_create ($type, $data=NULL, $conf=FALSE)
 panels_context_create_empty ($type, $conf=FALSE)
 panels_context_filter ($contexts, $required)
 panels_context_get_context ($context, $type= 'context')
 panels_context_get_contexts ($contexts, $type= 'context')
 panels_context_get_form ($contexts)
 panels_context_get_keywords ($contexts)
 panels_context_load_contexts ($object, $placeholders=TRUE, $contexts=array())
 panels_context_match_required_contexts ($required, $contexts)
 panels_context_select ($contexts, $required, $context)
 panels_context_selector ($contexts, $required, $default)
 panels_ct_conf_form ($ct_data, $contexts, $conf)
 panels_ct_get_content ($type, $conf, $args, $context, $incoming_content)
 panels_ct_get_title ($type, $conf, $context=NULL, $incoming_content=NULL)
 panels_ct_get_types ($type)
 panels_ct_pane_config_form ($pane, $contexts, $parents, $op, $content_type= 'content_types')
 panels_ct_pane_submit_form ($content_type, $form_values, $op)
 panels_ct_pane_validate_form ($content_type, $form, $form_values, $op)
 panels_get_all_content_types ()
 panels_get_argument ($argument)
 panels_get_arguments ()
 panels_get_available_content_types ($contexts=NULL, $has_content=FALSE, $allowed_types=NULL, $default_types=NULL)
 panels_get_cache ($cache)
 panels_get_cached_content ($display, $args, $context, $pane=NULL)
 panels_get_caches ()
 panels_get_content_type ($content_type)
 panels_get_content_types ()
 panels_get_context ($context)
 panels_get_contexts ()
 panels_get_include_directories ($plugin_type)
 panels_get_layout ($layout)
 panels_get_layouts ()
 panels_get_pane_content ($display, $pane, $args=array(), $context=NULL, $incoming_content= '')
 panels_get_pane_title (&$pane, $context=array(), $incoming_content=NULL)
 panels_get_panels ($layout, $display)
 panels_get_plugins ($plugin, $hook, $id=NULL)
 panels_get_relationship ($relationship)
 panels_get_relationships ()
 panels_get_relevant_relationships ($contexts)
 panels_get_style ($style)
 panels_get_styles ()
 panels_get_switcher ($switcher)
 panels_get_switchers ()
 panels_load_hooks ($hook)
 panels_load_includes ($plugin_type, $hook, $file=NULL)
 panels_pane_access ($pane, $display)
 panels_pane_select_context ($pane, $contexts, $context_type= 'required context')
 panels_panels_include_directory ($plugin_type)
 panels_plugin_get_function ($plugin, $which, $function_name)
 panels_relationship_context_id ($relationship)
 panels_relationship_get_context ($relationship, $arg)
 panels_relationship_get_contexts ($relationships, &$contexts)
 panels_set_cached_content ($cache, $display, $args, $context, $pane=NULL)
 panels_switcher_switch ($plugin, $type, $name, $candidates)


Function Documentation

_panels_context_filter ( contexts,
required 
)

Definition at line 974 of file plugins.inc.

Referenced by panels_context_filter().

00974                                                       {
00975   // TODO: Multiples
00976   $result = array();
00977 
00978   if (is_object($required)) {
00979     $result = $required->filter($contexts);
00980   }
00981 
00982   return $result;
00983 }

Here is the caller graph for this function:

_panels_context_select ( contexts,
required,
context 
)

Definition at line 1071 of file plugins.inc.

Referenced by panels_context_select().

01071                                                                 {
01072   if (!is_object($required)) {
01073     return FALSE;
01074   }
01075 
01076   return $required->select($contexts, $context);
01077 }

Here is the caller graph for this function:

_panels_context_selector ( contexts,
required,
default,
num = 0 
)

Definition at line 1011 of file plugins.inc.

References panels_context_filter().

Referenced by panels_context_selector().

01011                                                                             {
01012   $filtered = panels_context_filter($contexts, $required);
01013   $count = count($filtered);
01014 
01015   $form = array();
01016 
01017   if ($count == 1) {
01018     $keys = array_keys($filtered);
01019     return array(
01020       '#type' => 'value',
01021       '#value' => $keys[0],
01022     );
01023   }
01024 
01025   if ($count > 1) {
01026     // If there's more than one to choose from, create a select widget.
01027     foreach ($filtered as $cid => $context) {
01028       $options[$cid] = $context->get_identifier();
01029     }
01030     if (!empty($required->title)) {
01031       $title = $required->title;
01032     }
01033     else {
01034       $title = $num ? t('Context %count', array('%count' => $num)) : t('Context');
01035     }
01036 
01037     return array(
01038       '#type' => 'select',
01039       '#options' => $options,
01040       '#title' => $title,
01041       '#description' => t('Multiple contexts are valid for this pane; one must be chosen.'),
01042       '#default_value' => $default,
01043     );
01044   }
01045 }

Here is the call graph for this function:

Here is the caller graph for this function:

_panels_pane_access_role ( pane,
account 
)

Determine role-based access to a panel pane for the current user

Parameters:
object $pane The pane object to test.
object $account The current $user object.
Returns:
bool $role_access The boolean result of the roles-based segment of the Panels access system.

Definition at line 184 of file plugins.inc.

Referenced by panels_pane_access().

00184                                                    {
00185   // All views with an empty access setting are available to all roles.
00186   if (!$pane->access || !is_array($pane->access)) {
00187     return TRUE;
00188   }
00189 
00190   // Otherwise, check roles
00191   static $roles = array();
00192   if (!isset($roles[$account->uid])) {
00193     $roles[$account->uid] = array_keys($account->roles);
00194     $roles[$account->uid][] = $account->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
00195   }
00196 
00197   return array_intersect($pane->access, $roles[$account->uid]) ? TRUE : FALSE;
00198 }

Here is the caller graph for this function:

_panels_process_plugin ( module,
identifier,
path,
hook 
)

Process a single hook implementation of a panels plugin.

Parameters:
$module The module that owns the hook.
$identifier Either the module or 'panels_' . $file->name
$hook The name of the hook being invoked.

Definition at line 1473 of file plugins.inc.

Referenced by panels_load_hooks(), and panels_load_includes().

01473                                                                     {
01474   $function = $identifier . '_' . $hook;
01475   if (!function_exists($function)) {
01476     return NULL;
01477   }
01478   $result = $function();
01479   if (!isset($result) || !is_array($result)) {
01480     return NULL;
01481   }
01482 
01483   // Fill in defaults.
01484   foreach ($result as $name => $plugin) {
01485     $result[$name]['module'] = $module;
01486     $result[$name]['name'] = $name;
01487     $result[$name]['path'] = $path;
01488     // Add some content type-specific defaults, but allow them to be overridden by declarations in the content type.
01489     if (preg_match('/content_type/', $hook)) {
01490       $result[$name] = array_merge(array('single' => FALSE, 'visibility serialize' => FALSE, 'role-based access' => TRUE), $result[$name]);
01491     }
01492   }
01493   return $result;
01494 }

Here is the caller graph for this function:

panels_argument_choose_display ( type,
conf,
context 
)

Pick which display an argument wants to use

Definition at line 772 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_argument_get_display().

00772                                                                 {
00773   if ($function = panels_plugin_get_function('arguments', $type, 'choose display')) {
00774     return $function($conf, $context);
00775   }
00776 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_argument_context_id ( argument  ) 

Determine a unique context ID for an argument

Definition at line 781 of file plugins.inc.

Referenced by panels_argument_get_contexts(), panels_argument_get_display(), panels_argument_load_contexts(), panels_page_menu(), and theme_panels_common_context_list().

00781                                                {
00782   return "argument_$argument[name]_$argument[id]";
00783 }

Here is the caller graph for this function:

panels_argument_get_context ( argument,
arg,
empty = FALSE 
)

Get a context from an argument

Definition at line 756 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_argument_get_contexts(), panels_argument_load_contexts(), and panels_page_menu().

00756                                                                       {
00757   if ($function = panels_plugin_get_function('arguments', $argument['name'], 'context')) {
00758     $context = $function($arg, $argument['argument_settings'], $empty);
00759 
00760     if ($context) {
00761       $context->identifier = $argument['identifier'];
00762       $context->page_title = $argument['title'];
00763       $context->keyword    = $argument['keyword'];
00764       return $context;
00765     }
00766   }
00767 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_argument_get_contexts ( arguments  ) 

Retrieve a list of empty contexts for all arguments

Definition at line 788 of file plugins.inc.

References panels_argument_context_id(), and panels_argument_get_context().

Referenced by panels_context_load_contexts().

00788                                                   {
00789   $contexts = array();
00790   foreach ($arguments as $argument) {
00791     $context = panels_argument_get_context($argument, NULL, true);
00792     if ($context) {
00793       $contexts[panels_argument_context_id($argument)] = $context;
00794     }
00795   }
00796   return $contexts;
00797 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_argument_get_display ( arguments,
contexts 
)

Choose a display based upon arguments and loaded contexts.

Parameters:
$arguments The array of argument definitions
$contexts The array of existing contexts.
Returns:
The identification of the display to use

Definition at line 847 of file plugins.inc.

References panels_argument_choose_display(), and panels_argument_context_id().

Referenced by panels_page_view_page().

00847                                                             {
00848   $display_candidate = NULL;
00849   foreach ($arguments as $i => $argument) {
00850     $id = panels_argument_context_id($argument);
00851     if (!empty($contexts[$id]) && !empty($contexts[$id]->data)) {
00852       $context = $contexts[$id];
00853       $d = panels_argument_choose_display($argument['name'], $argument['argument_settings'], $context);
00854       if ($d) {
00855         $display_candidate = "argument_$i" . '-' . $d;
00856       }
00857     }
00858   }
00859 
00860   return $display_candidate;
00861 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_argument_load_contexts ( arguments,
&$  contexts,
args 
)

Load the contexts for a given panel.

Parameters:
$arguments The array of argument definitions
&$contexts The array of existing contexts.
$args The arguments to load
Returns:
FALSE if an argument wants to 404.

Definition at line 812 of file plugins.inc.

References panels_argument_context_id(), and panels_argument_get_context().

Referenced by panels_page_view_page().

00812                                                                       {
00813   foreach ($arguments as $argument) {
00814     // pull the argument off the list.
00815     $arg = array_shift($args);
00816     $id = panels_argument_context_id($argument);
00817 
00818     // For % arguments embedded in the URL, our context is already loaded.
00819     // There is no need to go and load it again.
00820     if (empty($contexts[$id])) {
00821       if ($context = panels_argument_get_context($argument, $arg)) {
00822         $contexts[$id] = $context;
00823       }
00824     }
00825     else {
00826       $context = $contexts[$id];
00827     }
00828 
00829     if ((empty($context) || empty($context->data)) && $argument['default'] == '404') {
00830       return FALSE;
00831     }
00832   }
00833   return TRUE;
00834 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_clear_cached_content ( display  ) 

Clear all cached content for a display.

Definition at line 600 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_save_display().

00600                                                {
00601   // Figure out every method we might be using to cache content in this display:
00602   $methods = array();
00603   if (!empty($display->cache['method'])) {
00604     $methods[$display->cache['method']] = TRUE;
00605   }
00606 
00607   foreach ($display->content as $pane) {
00608     if (!empty($pane->cache['method'])) {
00609       $methods[$pane->cache['method']] = TRUE;
00610     }
00611   }
00612 
00613   foreach (array_keys($methods) as $method) {
00614     $function = panels_plugin_get_function('cache', $method, 'cache clear');
00615     if ($function) {
00616       $function($display);
00617     }
00618   }
00619 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_context_id ( context,
type = 'context' 
)

Determine a unique context ID for a context

Todo:
can probably combine the various versions of this.

Definition at line 1128 of file plugins.inc.

Referenced by panels_common_ajax_context_item_edit(), panels_context_get_contexts(), panels_context_match_required_contexts(), and theme_panels_common_context_list().

01128                                                                 {
01129   return $type . "_$context[name]_$context[id]";
01130 }

Here is the caller graph for this function:

panels_context_create ( type,
data = NULL,
conf = FALSE 
)

Create a new context.

Parameters:
$type The type of context to create; this loads a plugin.
$data The data to put into the context.
$conf A configuration structure if this context was created via UI.
Returns:
A $context or NULL if one could not be created.

Definition at line 1092 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_book_parent_context(), panels_nid_context(), panels_node_add_context(), panels_node_edit_content(), panels_node_edit_context(), panels_node_edit_layout(), panels_node_view(), panels_term_context(), panels_term_from_node_context(), panels_term_parent_context(), panels_uid_context(), panels_user_from_node_context(), and panels_vid_context().

01092                                                                    {
01093   if ($function = panels_plugin_get_function('contexts', $type, 'context')) {
01094     return $function(FALSE, $data, $conf);
01095   }
01096 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_create_empty ( type,
conf = FALSE 
)

Definition at line 1098 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_book_parent_context(), panels_nid_context(), panels_node_add_context(), panels_node_edit_context(), panels_term_context(), panels_term_from_node_context(), panels_term_parent_context(), panels_uid_context(), panels_user_from_node_context(), and panels_vid_context().

01098                                                            {
01099   if ($function = panels_plugin_get_function('contexts', $type, 'context')) {
01100     return $function(TRUE, NULL, $conf);
01101   }
01102 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_filter ( contexts,
required 
)

Return a keyed array of context that match the given 'required context' filters.

Parameters:
$contexts A keyed array of all available contexts.
$required The required context string or array.
Returns:
A keyed array of contexts.

Definition at line 962 of file plugins.inc.

References _panels_context_filter().

Referenced by _panels_context_selector(), panels_get_available_content_types(), and panels_get_relevant_relationships().

00962                                                      {
00963   if (is_array($required)) {
00964     $result = array();
00965     foreach ($required as $r) {
00966       $result = array_merge($result, _panels_context_filter($contexts, $r));
00967     }
00968     return $result;
00969   }
00970 
00971   return _panels_context_filter($contexts, $required);
00972 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_get_context ( context,
type = 'context' 
)

Get a context from a context object.

Definition at line 1135 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_context_get_contexts().

01135                                                                  {
01136   if ($function = panels_plugin_get_function('contexts', $context['name'], 'context')) {
01137     $return = $function($type == 'requiredcontext', $context['context_settings'], TRUE);
01138     if ($return) {
01139       $return->identifier = $context['identifier'];
01140       $return->page_title = $context['title'];
01141       $return->keyword    = $context['keyword'];
01142       return $return;
01143     }
01144   }
01145 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_get_contexts ( contexts,
type = 'context' 
)

Retrieve a list of empty contexts for all contexts

Definition at line 1150 of file plugins.inc.

References panels_context_context_id(), and panels_context_get_context().

Referenced by panels_context_load_contexts().

01150                                                                    {
01151   $return = array();
01152   foreach ($contexts as $context) {
01153     $ctext = panels_context_get_context($context, $type);
01154     if ($ctext) {
01155       $return[panels_context_context_id($context, $type)] = $ctext;
01156     }
01157   }
01158   return $return;
01159 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_get_form ( contexts  ) 

Return the first context with a form id from a list of contexts.

Definition at line 1212 of file plugins.inc.

Referenced by panels_page_view_page().

01212                                             {
01213   foreach ($contexts as $context) {
01214     if (!empty($context->form_id)) {
01215       return $context;
01216     }
01217   }
01218 }

Here is the caller graph for this function:

panels_context_get_keywords ( contexts  ) 

Fetch keywords for use in string substitutions.

Parameters:
$contexts An array of contexts.
Returns:
An array of keyword substitutions suitable for strtr()

Definition at line 1113 of file plugins.inc.

Referenced by panels_page_view_page().

01113                                                 {
01114   $keywords = array();
01115   foreach ($contexts as $id => $context) {
01116     if ($keyword = $context->get_keyword()) {
01117       $keywords["%$keyword"] = $context->get_title();
01118     }
01119   }
01120   return $keywords;
01121 }

Here is the caller graph for this function:

panels_context_load_contexts ( object,
placeholders = TRUE,
contexts = array() 
)

Get a group of empty contexts for the object; this assumes all the standard context types, and doesn't punish you if they aren't available.

Definition at line 1166 of file plugins.inc.

References panels_argument_get_contexts(), panels_context_get_contexts(), and panels_relationship_get_contexts().

Referenced by panels_common_add_relationship_form(), panels_common_ajax_context_item_add(), panels_common_ajax_context_item_edit(), panels_mini_block(), panels_mini_content(), panels_mini_edit_content(), panels_mini_edit_form(), panels_mini_preview_panel(), panels_node_edit_content(), panels_node_view(), panels_page_admin_view(), panels_page_edit_content(), panels_page_edit_form(), and panels_page_view_page().

01166                                                                                           {
01167   if ($placeholders) {
01168     // This will load empty contexts as placeholders for arguments that come
01169     // from external sources. If this isn't set, it's assumed these context
01170     // will already have been matched up and loaded.
01171     if (!empty($object->requiredcontexts) && is_array($object->requiredcontexts)) {
01172       $contexts += panels_context_get_contexts($object->requiredcontexts, 'requiredcontext');
01173     }
01174 
01175     if (!empty($object->arguments) && is_array($object->arguments)) {
01176       $contexts += panels_argument_get_contexts($object->arguments);
01177     }
01178   }
01179 
01180   if (!empty($object->contexts) && is_array($object->contexts)) {
01181     $contexts += panels_context_get_contexts($object->contexts);
01182   }
01183 
01184   // add contexts from relationships
01185   if (!empty($object->relationships) && is_array($object->relationships)) {
01186     panels_relationship_get_contexts($object->relationships, $contexts);
01187   }
01188 
01189   return $contexts;
01190 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_match_required_contexts ( required,
contexts 
)

Match up external contexts to our required contexts. It shouldn't be possible to get here without the contexts already lining up properly.

Definition at line 1196 of file plugins.inc.

References panels_context_context_id().

Referenced by panels_mini_content().

01196                                                                       {
01197   $return = array();
01198   if (!is_array($required)) {
01199     return $return;
01200   }
01201 
01202   foreach ($required as $r) {
01203     $return[panels_context_context_id($r, 'requiredcontext')] = array_shift($contexts);
01204   }
01205 
01206   return $return;
01207 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_select ( contexts,
required,
context 
)

Choose a context based upon the selection made via panels_context_filter

Parameters:
$contexts A keyed array of all available contexts
$required The required context object provided by the plugin
$context The selection made using panels_context_selector

Definition at line 1057 of file plugins.inc.

References _panels_context_select().

Referenced by panels_pane_select_context().

01057                                                                {
01058   if (is_array($required)) {
01059     $result = array();
01060     foreach ($required as $id => $r) {
01061       if (($result[] = _panels_context_select($contexts, $r, $context[$id])) == FALSE) {
01062         return FALSE;
01063       }
01064     }
01065     return $result;
01066   }
01067 
01068   return _panels_context_select($contexts, $required, $context);
01069 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_context_selector ( contexts,
required,
default 
)

Create a select box to choose possible contexts. This only creates a selector if there is actually a choice.

Parameters:
$contexts A keyed array of all available contexts.
$required The required context string or array.
Returns:
A form element, or NULL if there are no contexts that satisfy the requirements.

Definition at line 998 of file plugins.inc.

References _panels_context_selector().

Referenced by panels_common_edit_relationship_form(), and panels_ct_conf_form().

00998                                                                  {
00999   if (is_array($required)) {
01000     $result = array();
01001     $count = 1;
01002     foreach ($required as $id => $r) {
01003       $result[] = _panels_context_selector($contexts, $r, $default[$id], $count++);
01004     }
01005     return $result;
01006   }
01007 
01008   return _panels_context_selector($contexts, $required, $default);
01009 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_conf_form ( ct_data,
contexts,
conf 
)

Add the default FAPI elements to the content type configuration form

Definition at line 251 of file plugins.inc.

References panels_context_selector(), and panels_get_styles().

Referenced by panels_content_config_form().

00251                                                          {
00252   list($subtype, $content_type) = array($ct_data['subtype'], $ct_data['type']);
00253 
00254   if (!empty($subtype['required context']) && is_array($contexts)) {
00255     $form['context'] = panels_context_selector($contexts, $subtype['required context'], isset($conf['context']) ? $conf['context'] : array());
00256   }
00257   elseif (!empty($subtype['optional context']) && is_array($contexts)) {
00258     $form['context'] = panels_context_selector($contexts, $subtype['optional context'], isset($conf['context']) ? $conf['context'] : array());
00259   }
00260 
00261   $style_options = array('default' => t('Default'));
00262   foreach (panels_get_styles() as $name => $properties) {
00263     if (empty($properties['hidden']) && (!empty($properties['render pane']))) {
00264       $style_options[$name] = $properties['title'];
00265     }
00266   }
00267 
00268   asort($style_options);
00269 
00270   if (empty($conf['style'])) {
00271     $conf['style'] = 'default';
00272   }
00273 
00274   if ($style_options) {
00275     $form['style'] = array(
00276       '#type' => 'select',
00277       '#title' => t('Pane style'),
00278       '#default_value' => $conf['style'],
00279       '#options' => $style_options,
00280     );
00281   }
00282 
00283   // Unless we're not allowed to overide the title on this content type, add this
00284   // gadget to all panes.
00285   if (empty($content_type['no title override'])) {
00286     $form['aligner_start'] = array(
00287       '#value' => '<div class="option-text-aligner">',
00288     );
00289     $form['override_title'] = array(
00290       '#type' => 'checkbox',
00291       '#default_value' => isset($conf['override_title']) ? $conf['override_title'] : '',
00292       '#title' => t('Override title'),
00293       '#id' => 'override-title-checkbox',
00294     );
00295     $form['override_title_text'] = array(
00296       '#type' => 'textfield',
00297       '#default_value' => isset($conf['override_title_text']) ? $conf['override_title_text'] : '',
00298       '#size' => 35,
00299       '#id' => 'override-title-textfield',
00300     );
00301     $form['aligner_stop'] = array(
00302       '#value' => '</div><div style="clear: both; padding: 0; margin: 0"></div>',
00303     );
00304     $form['override_title_markup'] = array(
00305       '#prefix' => '<div class="description">',
00306       '#suffix' => '</div>',
00307       '#value' => t('You may use %keywords from contexts, as well as %title to contain the original title.'),
00308     );
00309   }
00310 
00311   // Add CSS class and ID gadgets to all panes if advanced pane settings is set.
00312   if (user_access('administer advanced pane settings')) {
00313     $form['css_id'] = array(
00314       '#type' => 'textfield',
00315       '#default_value' => isset($conf['css_id']) ? $conf['css_id'] : '',
00316       '#title' => t('CSS ID'),
00317       '#description' => t('CSS ID to apply to this content. This may be blank.'),
00318       '#weight' => 2,
00319       '#size' => 15,
00320     );
00321     $form['css_class'] = array(
00322       '#type' => 'textfield',
00323       '#default_value' => isset($conf['css_class']) ? $conf['css_class'] : '',
00324       '#title' => t('CSS class'),
00325       '#description' => t('CSS class to apply to this content. This may be blank.'),
00326       '#weight' => 2,
00327       '#size' => 15,
00328     );
00329   }
00330 
00331   return $form;
00332 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_get_content ( type,
conf,
args,
context,
incoming_content 
)

Get the content from a given content type.

Parameters:
$type The content type. May be the name or an already loaded content type object.
$conf The configuration for the content type.
$args The arguments to the content type.
$context The panels_context object. $incoming_content Any incoming content, if this display is a wrapper.

Definition at line 214 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_get_pane_content().

00214                                                                                  {
00215   if ($function = panels_plugin_get_function('content_types', $type, 'render callback')) {
00216     $content = $function($conf, $args, $context, $incoming_content);
00217     if (empty($content->title) && !empty($content->subject)) {
00218       $content->title = $content->subject;
00219     }
00220 
00221     if (!empty($content->title) && empty($content->subject)) {
00222       $content->subject = $content->title;
00223     }
00224 
00225     return $content;
00226   }
00227 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_get_title ( type,
conf,
context = NULL,
incoming_content = NULL 
)

Get the title from a given content type.

Parameters:
$type The content type. May be the name or an already loaded content type object.
$conf The configuration for the content type.
$context The panels_context object.
$incoming_content Any incoming content, if this display is a wrapper.

Definition at line 241 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_get_pane_title().

00241                                                                                       {
00242   if ($function = panels_plugin_get_function('content_types', $type, 'title callback')) {
00243     return $function($conf, $context, $incoming_content);
00244   }
00245   return t('Deleted/missing content type @type', array('@type' => $type));
00246 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_get_types ( type  ) 

Get all of the individual types provided by a given content types. This would be all of the blocks for the block type, or all of the views for the view type.

Parameters:
$type The content type to load.

Definition at line 405 of file plugins.inc.

References panels_get_content_type().

Referenced by panels_get_all_content_types(), panels_get_available_content_types(), and panels_pane_select_context().

00405                                     {
00406   if (is_array($type)) {
00407     $content_type = $type;
00408   }
00409   else {
00410     $content_type = panels_get_content_type($type);
00411   }
00412 
00413   $function = $content_type['content_types'];
00414   if (is_array($function)) {
00415     return (array) $function;
00416   }
00417 
00418   if (function_exists($function)) {
00419     return (array) $function();
00420   }
00421   return array();
00422 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_pane_config_form ( pane,
contexts,
parents,
op,
content_type = 'content_types' 
)

Call any content type-defined add/edit callbacks so that additions to $form['configuration'] can be made.

See also:
panels_content_config_form()
Parameters:
object $pane The $pane object currently being edited.
$contexts A list of possible contexts.
$parents The parents to be used on the form, because some form gadgets need to know where they live.
string $op Either 'add' or 'edit' depending on the operation being performed.
mixed $content_type This variable should only be passed if the calling function already has access to the relevant content_type data and wants to save a little on performance. If so, then the fully-loaded content type plugin declaration array should be passed.

Definition at line 354 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_content_config_form().

00354                                                                                                       {
00355   if ($function = panels_plugin_get_function($content_type, $pane->type, "$op callback")) {
00356     return $function($pane->subtype, $parents, $pane->configuration);
00357   }
00358 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_pane_submit_form ( content_type,
form_values,
op 
)

Call any add/edit submit handlers defined by the content type.

Parameters:
string $content_type A string value containing the name of the content type.
$form_values The $form_values['configuration'] sub-array generated by FAPI for the overall ct add/edit submit handler.
string $op Either 'add' or 'edit' depending on the operation being performed.

Definition at line 391 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_content_config_form_submit().

00391                                                                       {
00392   if ($function = panels_plugin_get_function('content_types', $content_type, "$op submit callback")) {
00393     return $function($form_values);
00394   }
00395 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_ct_pane_validate_form ( content_type,
form,
form_values,
op 
)

Call any add/edit validators defined by the content type.

See also:
panels_content_config_form_validate()
Parameters:
$type The content type. May be the name or an already loaded content type object.
$form The actual Forms API form that is being validated.
$form_values The actual Forms API values being validated.
string $op Either 'add' or 'edit' depending on the operation being performed.

Definition at line 374 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_content_config_form_validate().

00374                                                                                {
00375   if ($function = panels_plugin_get_function('content_types', $content_type, "$op validate callback")) {
00376     return $function($form, $form_values);
00377   }
00378 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_all_content_types (  ) 

Get an array of all content types that can be fed into the display editor for the add content list, regardless of availability.

Definition at line 493 of file plugins.inc.

References panels_ct_get_types(), and panels_get_content_types().

Referenced by panels_common_settings().

00493                                         {
00494   $content_types = panels_get_content_types();
00495   $available = array();
00496 
00497   foreach ($content_types as $id => $type) {
00498     foreach (panels_ct_get_types($type) as $cid => $cinfo) {
00499       // If we made it through all the tests, then we can use this content.
00500       $available[$id][$cid] = $cinfo;
00501     }
00502   }
00503   return $available;
00504 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_argument ( argument  ) 

Collate information about a specific panel argument.

Parameters:
$argument Name of a panel argument.
Returns:
An array with information about the requested panel argument.

Definition at line 1601 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_page_context_form_submit(), and panels_update_5209().

01601                                         {
01602   return panels_get_plugins('arguments', 'panels_arguments', $argument);
01603 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_arguments (  ) 

Collate information about all available panel arguments.

Returns:
An array of arrays with information about all available panel arguments.

Definition at line 1611 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_common_add_argument_form().

01611                                 {
01612   return panels_get_plugins('arguments', 'panels_arguments');
01613 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_available_content_types ( contexts = NULL,
has_content = FALSE,
allowed_types = NULL,
default_types = NULL 
)

Get an array of all available content types that can be fed into the display editor for the add content list.

Parameters:
$context If a context is provided, content that requires that context can apepar.
$has_content Whether or not the display will have incoming content
$allowed_types An array of allowed content types (pane types) keyed by content_type . '-' . sub_type
$default_types A default allowed/denied status for content that isn't known about

Definition at line 450 of file plugins.inc.

References panels_context_filter(), panels_ct_get_types(), and panels_get_content_types().

Referenced by panels_add_content(), and panels_common_get_allowed_types().

00450                                                                                                                                   {
00451   $content_types = panels_get_content_types();
00452   $available = array();
00453 
00454   foreach ($content_types as $id => $type) {
00455     foreach (panels_ct_get_types($type) as $cid => $cinfo) {
00456       // exclude items that require content if we're saying we don't
00457       // provide it.
00458       if (!empty($cinfo['requires content']) && !$has_content) {
00459         continue;
00460       }
00461 
00462       // Check to see if the content type can be used in this context.
00463       if (!empty($cinfo['required context'])) {
00464         if (!panels_context_filter($contexts, $cinfo['required context'])) {
00465           continue;
00466         }
00467       }
00468 
00469       // Check to see if the passed-in allowed types allows this content.
00470       if ($allowed_types) {
00471         $key = $id . '-' . $cid;
00472         if (!isset($allowed_types[$key])) {
00473           $allowed_types[$key] = isset($default_types[$id]) ? $default_types[$id] : $default_types['other'];
00474         }
00475         if (!$allowed_types[$key]) {
00476           continue;
00477         }
00478       }
00479 
00480       // If we made it through all the tests, then we can use this content.
00481       $available[$id][$cid] = $cinfo;
00482     }
00483   }
00484   return $available;
00485 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_cache ( cache  ) 

Fetch a cache plugin

Parameters:
$cache Name of a panel cache.
Returns:
An array with information about the requested panel cache.

Definition at line 1693 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_edit_cache_settings_form().

01693                                   {
01694   return panels_get_plugins('cache', 'panels_cache', $cache);
01695 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_cached_content ( display,
args,
context,
pane = NULL 
)

Get cached content for a given display and possibly pane.

Returns:
The cached content, or FALSE to indicate no cached content exists.

Definition at line 560 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_get_pane_content(), and panels_render_layout().

00560                                                                             {
00561   $method = $pane ? $pane->cache['method'] : $display->cache['method'];
00562   $function = panels_plugin_get_function('cache', $method, 'cache get');
00563 
00564   if (!$function) {
00565     return FALSE;
00566   }
00567 
00568   $conf = $pane ? $pane->cache['settings'] : $display->cache['settings'];
00569   $cache = $function($conf, $display, $args, $context, $pane);
00570   if (empty($cache)) {
00571     return FALSE;
00572   }
00573 
00574   // restore it.
00575   $cache->restore();
00576   return $cache;
00577 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_caches (  ) 

Fetch all cache plugins

Returns:
An array of arrays with information about all available panel caches.

Definition at line 1703 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_content_config_add_form_submit(), panels_edit_cache_method_form(), and panels_edit_display().

01703                              {
01704   return panels_get_plugins('cache', 'panels_cache');
01705 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_content_type ( content_type  ) 

Fetch a content_type plugin

Parameters:
$content type Name of a panel content type.
Returns:
An array with information about the requested panel content type.

Definition at line 1624 of file plugins.inc.

References panels_get_plugins().

Referenced by _panels_ajax_ct_preconfigure(), panels_ct_get_types(), panels_pane_access(), panels_render_panes(), panels_save_display(), and panels_show_pane().

01624                                                 {
01625   return panels_get_plugins('content_types', 'panels_content_types', $content_type);
01626 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_content_types (  ) 

Fetch all content type plugins

Returns:
An array of arrays with information about all available panel content types.

Definition at line 1634 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_common_settings(), panels_get_all_content_types(), and panels_get_available_content_types().

01634                                     {
01635   return panels_get_plugins('content_types', 'panels_content_types');
01636 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_context ( context  ) 

Fetch a context plugin

Parameters:
$context Name of a panel context.
Returns:
An array with information about the requested panel context.

Definition at line 1670 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_mini_content_types().

01670                                       {
01671   return panels_get_plugins('contexts', 'panels_contexts', $context);
01672 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_contexts (  ) 

Fetch all context plugins

Returns:
An array of arrays with information about all available panel contexts.

Definition at line 1680 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_common_add_context_form(), panels_common_add_required_context_form(), and panels_views_edit_view_form().

01680                                {
01681   return panels_get_plugins('contexts', 'panels_contexts');
01682 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_layout ( layout  ) 

Fetch a layout plugin

Parameters:
$layout Name of a panel layout.
Returns:
An array with information about the requested panel layout.

Definition at line 1555 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_ajax_add_content(), panels_change_layout(), panels_common_get_layout_information(), panels_edit_display(), panels_edit_layout_settings_form(), panels_mini_context_form(), panels_mini_edit_form(), panels_mini_edit_form_submit(), panels_node_form(), panels_page_context_form(), panels_page_edit_form(), panels_page_edit_form_submit(), panels_panel_settings(), panels_print_layout(), panels_render_display(), theme_panels_common_content_list(), and theme_panels_edit_display().

01555                                     {
01556   return panels_get_plugins('layouts', 'panels_layouts', $layout);
01557 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_layouts (  ) 

Fetch all layout plugins

Returns:
An array of arrays with information about all available panel layouts.

Definition at line 1565 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_allowed_layouts::list_layouts(), panels_choose_layout(), panels_common_set_allowed_layouts(), panels_mini_add_page(), panels_mini_list_page(), panels_node_add(), panels_page_add_page(), and panels_page_list_page().

01565                               {
01566   return panels_get_plugins('layouts', 'panels_layouts');
01567 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_pane_title ( &$  pane,
context = array(),
incoming_content = NULL 
)

Get the title of a pane.

Parameters:
$pane The $pane object.

Definition at line 740 of file plugins.inc.

References panels_ct_get_title(), and panels_pane_select_context().

Referenced by _panels_render_preview_pane_disabled(), panels_common_get_layout_information(), panels_show_pane(), and theme_panels_common_content_list().

00740                                                                                      {
00741   if (empty($pane->context)) {
00742     $pane->context = panels_pane_select_context($pane, $context);
00743     if ($pane->context === FALSE) {
00744       return t('Does not meet context requirements');
00745     }
00746   }
00747   return panels_ct_get_title($pane->type, $pane->configuration, $pane->context, $incoming_content);
00748 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_panels ( layout,
display 
)

Get a list of panels available in the layout.

Definition at line 427 of file plugins.inc.

Referenced by panels_ajax_add_content(), panels_change_layout(), panels_common_get_layout_information(), panels_edit_display(), panels_panel_settings(), theme_panels_common_content_list(), and theme_panels_edit_display().

00427                                               {
00428   if (!empty($layout['panels function']) && function_exists($layout['panels function'])) {
00429     return $layout['panels function']($display, $display->layout_settings);
00430   }
00431   if (!empty($layout['panels'])) {
00432     return $layout['panels'];
00433   }
00434   return array();
00435 }

Here is the caller graph for this function:

panels_get_plugins ( plugin,
hook,
id = NULL 
)

Fetch a group of plugins by name.

Parameters:
$plugin This is the name of the plugin, and also the name of the directory.
$hook This is the hook to call to get the info for the plugin.
Returns:
An array of information arrays about the plugins received.

Definition at line 1507 of file plugins.inc.

References panels_load_hooks(), and panels_load_includes().

Referenced by panels_get_argument(), panels_get_arguments(), panels_get_cache(), panels_get_caches(), panels_get_content_type(), panels_get_content_types(), panels_get_context(), panels_get_contexts(), panels_get_layout(), panels_get_layouts(), panels_get_relationship(), panels_get_relationships(), panels_get_style(), panels_get_styles(), panels_get_switcher(), panels_get_switchers(), and panels_plugin_get_function().

01507                                                         {
01508   static $plugins = array();
01509   static $all_hooks = array();
01510   static $all_files = array();
01511 
01512   // Always load all hooks if we need them.
01513   if (!isset($all_hooks[$plugin])) {
01514     $all_hooks[$plugin] = TRUE;
01515     $plugins[$plugin] = panels_load_hooks($hook);
01516   }
01517 
01518   // First, see if it's in our hooks before we even bother.
01519   if ($id && array_key_exists($id, $plugins[$plugin])) {
01520     return $plugins[$plugin][$id];
01521   }
01522 
01523   // Then see if we should load all files. We only do this if we
01524   // want a list of all plugins.
01525   if (!$id && empty($all_files[$plugin])) {
01526     $all_files[$plugin] = TRUE;
01527     $plugins[$plugin] = array_merge($plugins[$plugin], panels_load_includes($plugin, $hook));
01528   }
01529 
01530   // If no id was requested, we are finished here:
01531   if (!$id) {
01532     return $plugins[$plugin];
01533   }
01534 
01535   // Check to see if we need to look for the file
01536   if (!array_key_exists($id, $plugins[$plugin])) {
01537     $result = panels_load_includes($plugin, $hook, $id);
01538     // Set to either what was returned or NULL.
01539     $plugins[$plugin][$id] = isset($result[$id]) ? $result[$id] : NULL;
01540   }
01541 
01542   // At this point we should either have the plugin, or a NULL.
01543   return $plugins[$plugin][$id];
01544 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_relationship ( relationship  ) 

Fetch a relationship plugin

Parameters:
$content type Name of a panel content type.
Returns:
An array with information about the requested relationship

Definition at line 1647 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_relationship_get_contexts(), and panels_update_5209().

01647                                                 {
01648   return panels_get_plugins('relationships', 'panels_relationships', $relationship);
01649 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_relationships (  ) 

Fetch all relationship plugins

Returns:
An array of arrays with information about all available relationships.

Definition at line 1657 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_get_relevant_relationships().

01657                                     {
01658   return panels_get_plugins('relationships', 'panels_relationships');
01659 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_relevant_relationships ( contexts  ) 

Fetch all relevant relationships

Parameters:
$contexts An array of contexts used to figure out which relationships are relevant.
Returns:
An array of relationship keys that are relevant for the given set of arguments.

Definition at line 876 of file plugins.inc.

References panels_context_filter(), and panels_get_relationships().

Referenced by panels_common_add_relationship_form(), and panels_common_ajax_context_item_add().

00876                                                       {
00877   $relevant = array();
00878   $relationships = panels_get_relationships();
00879 
00880   // Go through each relationship
00881   foreach ($relationships as $rid => $relationship) {
00882     // For each relationship, see if there is a context that satisfies it.
00883     if (panels_context_filter($contexts, $relationship['required context'])) {
00884       $relevant[$rid] = $relationship['title'];
00885     }
00886   }
00887 
00888   return $relevant;
00889 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_style ( style  ) 

Collate information about a specific panel style.

Parameters:
$style Name of a panel style.
Returns:
An array with information about the requested panel style.

Definition at line 1578 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_get_panel_style_and_settings(), panels_panel_settings(), panels_panel_settings_ajax(), and panels_render_pane().

01578                                   {
01579   return panels_get_plugins('styles', 'panels_styles', $style);
01580 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_styles (  ) 

Collate information about all available panel styles.

Returns:
An array of arrays with information about all available panel styles.

Definition at line 1588 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_ct_conf_form(), and panels_panel_settings().

01588                              {
01589   return panels_get_plugins('styles', 'panels_styles');
01590 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_get_switcher ( switcher  ) 

Fetch a switcher plugin

Parameters:
$switcher Name of a panel switcher.
Returns:
An array with information about the requested panel switcher.

Definition at line 1716 of file plugins.inc.

References panels_get_plugins().

01716                                         {
01717   return panels_get_plugins('switchers', 'panels_switchers', $switcher);
01718 }

Here is the call graph for this function:

panels_get_switchers (  ) 

Fetch all switcher plugins

Returns:
An array of arrays with information about all available panel switchers.

Definition at line 1726 of file plugins.inc.

References panels_get_plugins().

Referenced by panels_page_view_page().

01726                                 {
01727   return panels_get_plugins('switchers', 'panels_switchers');
01728 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_load_includes ( plugin_type,
hook,
file = NULL 
)

Load plugins from a directory.

Parameters:
$plugin_type The plugin type, as well as the panels directory where the plugin is kept. A list of additional directories to search for relevant plugins is generated by invoking hook_panels_include_directory();
$hook The name of the hook to be invoked.
$file The file to load if we're looking for just one particular plugin.
Returns:
An array of information created for this plugin.

Definition at line 1325 of file plugins.inc.

References _panels_process_plugin(), and panels_get_include_directories().

Referenced by panels_get_plugins().

01325                                                                  {
01326   // Load all our plugins.
01327   $directories = panels_get_include_directories($plugin_type);
01328   // $directories['panels'] = panels_get_path($plugin_type);
01329   $file_list = array();
01330   foreach ($directories as $module => $path) {
01331     $file_list[$module] = drupal_system_listing("$file" . '.inc$', $path, 'name', 0);
01332   }
01333   $info = array();
01334   foreach (array_filter($file_list) as $module => $files) {
01335     foreach ($files as $file) {
01336       require_once ('./' . $file->filename);
01337       $result = _panels_process_plugin($module, $module . '_' . $file->name, dirname($file->filename), $hook);
01338       if (is_array($result)) {
01339         $info = array_merge($info, $result);
01340       }
01341     }
01342   }
01343   return $info;
01344 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_pane_access ( pane,
display 
)

Master pane access function; combines all the relevant parameters that natively used by the Panels API to determine a pane's access. Called from panels_render_panes().

Parameters:
$pane The pane object to test for access.
$display The display object containing the pane object to be tested.

Definition at line 148 of file plugins.inc.

References _panels_pane_access_role(), panels_get_content_type(), and panels_plugin_get_function().

Referenced by panels_render_panes().

00148                                              {
00149   global $user;
00150 
00151   // Administrator privileges
00152   if (user_access('view all pane', $user)) {
00153     return TRUE;
00154   }
00155 
00156   $role_access = _panels_pane_access_role($pane, $user);
00157   $type = panels_get_content_type($pane->type);
00158 
00159   if (!$visibility_check = panels_plugin_get_function('content_types', $type, 'visibility check')) {
00160     return $role_access;
00161   }
00162   // Call the content type's custom-defined visibility rendering check.
00163   // Pass as much possibly relevant data as possible.
00164   $visibility_access = $visibility_check($pane, $display, $user);
00165   // Content type marked both access modes to be ANDed together.
00166   if (!empty($type['roles and visibility'])) {
00167     return ($visibility_access === TRUE && $role_access === TRUE) ? TRUE : FALSE;
00168   }
00169   // Err on the safe side: if EVERYTHING else has failed, then don't render the pane.
00170   return isset($visibility_access) ? $visibility_access : FALSE;
00171 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_pane_select_context ( pane,
contexts,
context_type = 'required context' 
)

Select a context for a pane.

Parameters:
object $pane A fully populated pane.
array $contexts A keyed array of available contexts.
string $context_type Indicates whether a required or optional context is being sought.
Returns:
The matching contexts or NULL if none or necessary, or FALSE if requirements can't be met.

Definition at line 1234 of file plugins.inc.

References panels_context_select(), and panels_ct_get_types().

Referenced by panels_get_pane_title(), and panels_render_pane_content().

01234                                                                                           {
01235   // Identify which of our possible contexts apply.
01236   if (empty($pane->subtype)) {
01237     return;
01238   }
01239 
01240   $content_type = panels_ct_get_types($pane->type);
01241   // If the pane requires a context, fetch it; if no context is returned,
01242   // do not display the pane.
01243   if (empty($content_type[$pane->subtype][$context_type])) {
01244     return $context_type == 'required context' ? panels_pane_select_context($pane, $contexts, 'optional context') : NULL;
01245   }
01246 
01247   $context = panels_context_select($contexts, $content_type[$pane->subtype][$context_type], $pane->configuration['context']);
01248 
01249   return $context;
01250 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_panels_include_directory ( plugin_type  ) 

Implementation of hook_panels_include_directory().

See also:
panels_get_include_directories()
This simple implementation of hook_panels_include_directory() is sufficient to mark all seven of the Panels subdirectories corresponding to the different plugin types as plugin directories that the Panels engine will search for plugins of that type when a request for those plugins are made.

It is important that separate directories be defined for each of the plugin types. While failure to separate the plugin directories should not result in an error, it will undermine the Panels engine's lazy-loading logic and negatively impact memory usage.

Note also that including a conditional on the plugin type so that you only define plugins for directories that you have actually populated with plugin include files is another small contribution to performance that you can make. For example, if you define only content_type and context plugins and don't want them at the root level of your module directory, this code would work:

  function MYMODULE_panels_include_directory($plugin_type) {
    if ($plugin_type == 'content_types' || $plugin_type == 'contexts') {
      return 'panels_inc/' . $plugin_type;
    }
  }

Parameters:
string $plugin_type The plugin type for which the Panels engine is currently requesting the location of an include directory.
Returns:
string The location of the include directory for plugin type being requested, relative to the base directory of the module implementing this hook.

Definition at line 1426 of file plugins.inc.

01426                                                        {
01427   return $plugin_type;
01428 }

panels_plugin_get_function ( plugin,
which,
function_name 
)

Get a function from a plugin, if it exists.

Parameters:
$plugin The type of plugin
$which Either the loaded plugin object (or the same data in array form) or a string with the name of the desired the specific plugin.
$function_name The identifier of the function. For example, 'settings form'.
Returns:
The actual name of the function to call, or NULL if the function does not exist.

Definition at line 1294 of file plugins.inc.

References panels_get_plugins().

Referenced by _panels_ajax_ct_preconfigure(), panels_ajax_cache_settings(), panels_argument_choose_display(), panels_argument_get_context(), panels_clear_cached_content(), panels_content_config_form_submit(), panels_context_create(), panels_context_create_empty(), panels_context_get_context(), panels_ct_get_content(), panels_ct_get_title(), panels_ct_pane_config_form(), panels_ct_pane_submit_form(), panels_ct_pane_validate_form(), panels_edit_cache_settings_form_submit(), panels_edit_cache_settings_form_validate(), panels_get_cached_content(), panels_pane_access(), panels_relationship_get_context(), panels_set_cached_content(), and panels_switcher_switch().

01294                                                                      {
01295   if (is_object($which) || is_array($which)) {
01296     $plugin_data = $which;
01297   }
01298   else {
01299     $hook = "panels_$plugin";
01300     $plugin_data = panels_get_plugins($plugin, $hook, $which);
01301   }
01302 
01303   if (isset($plugin_data[$function_name]) && function_exists($plugin_data[$function_name])) {
01304     return $plugin_data[$function_name];
01305   }
01306 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_relationship_context_id ( relationship  ) 

Determine a unique context ID for an argument

Definition at line 928 of file plugins.inc.

Referenced by panels_relationship_get_contexts(), and theme_panels_common_context_list().

00928                                                        {
00929   return "relationship_$relationship[name]_$relationship[id]";
00930 }

Here is the caller graph for this function:

panels_relationship_get_context ( relationship,
arg 
)

Fetch a context from a relationship, given the context input.

Definition at line 935 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_relationship_get_contexts().

00935                                                               {
00936   if ($function = panels_plugin_get_function('relationships', $relationship['name'], 'context')) {
00937     $context = $function($arg, $relationship['relationship_settings']);
00938     if ($context) {
00939       $context->identifier = $relationship['identifier'];
00940       $context->page_title = $relationship['title'];
00941       $context->keyword    = $relationship['keyword'];
00942       return $context;
00943     }
00944   }
00945 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_relationship_get_contexts ( relationships,
&$  contexts 
)

Fetch all active relationships

Parameters:
$relationships An keyed array of relationship data including:
  • name: name of relationship
  • context: context id relationship belongs to.
$contexts A keyed array of contexts used to figure out which relationships are relevant. New contexts will be added to this.

Definition at line 904 of file plugins.inc.

References panels_get_relationship(), panels_relationship_context_id(), and panels_relationship_get_context().

Referenced by panels_context_load_contexts().

00904                                                                       {
00905   $return = array();
00906 
00907   foreach ($relationships as $rdata) {
00908     if (empty($contexts[$rdata['context']])) {
00909       continue;
00910     }
00911     $relationship = panels_get_relationship($rdata['name']);
00912     // If the relationship can't be found or its context can't be found,
00913     // ignore.
00914     if (!$relationship) {
00915       continue;
00916     }
00917 
00918     $cid = panels_relationship_context_id($rdata);
00919     if ($context = panels_relationship_get_context($rdata, $contexts[$rdata['context']])) {
00920       $contexts[$cid] = $context;
00921     }
00922   }
00923 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_set_cached_content ( cache,
display,
args,
context,
pane = NULL 
)

Store cached content for a given display and possibly pane.

Definition at line 582 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_get_pane_content(), and panels_render_layout().

00582                                                                                     {
00583   $method = $pane ? $pane->cache['method'] : $display->cache['method'];
00584   $function = panels_plugin_get_function('cache', $method, 'cache set');
00585 
00586   if (!$function) {
00587     return FALSE;
00588   }
00589 
00590   $conf = $pane ? $pane->cache['settings'] : $display->cache['settings'];
00591 
00592   // snapshot it.
00593   $cache->cache();
00594   return $function($conf, $cache, $display, $args, $context, $pane);
00595 }

Here is the call graph for this function:

Here is the caller graph for this function:

panels_switcher_switch ( plugin,
type,
name,
candidates 
)

Switch one object for another just prior to load.

Parameters:
$plugin The name or loaded plugin to delegate switching to.
$type The object type. eg, 'panels_page', 'panels_mini', etc.
$name The name of the object that might be switched.
$candidates A list of possible objects to switch to. The data conforms to what was set in the settings, and is keyed to the panel.
Returns:
The object to switch to. NULL if electing not to switch.

Definition at line 1272 of file plugins.inc.

References panels_plugin_get_function().

Referenced by panels_page_view_page().

01272                                                                     {
01273   $function = panels_plugin_get_function('switchers', $plugin, 'switch');
01274   if ($function) {
01275     return $function($type, $name, $candidates);
01276   }
01277 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Wed Mar 17 05:00:18 2010 for Panels 2 by  doxygen 1.5.6