You are here

function _panels_ajax_ct_preconfigure in Panels 5.2

Helper function for ajax pane type editing callbacks. When needed, preps the cached $display object with relevant data from the content type.

Parameters

array $cache: The loaded $cache object containing all the current $display editing data.

object $pane: The $pane object this ajax callback intends to operate on.

See also

panels_ajax_configure()

panels_ajax_add_config()

2 calls to _panels_ajax_ct_preconfigure()
panels_ajax_add_config in includes/display_edit.inc
Entry point for AJAX: Add pane configuration.
panels_ajax_configure in includes/display_edit.inc
Entry point for AJAX: Edit pane configuration.

File

includes/display_edit.inc, line 974

Code

function _panels_ajax_ct_preconfigure(&$cache, &$pane) {
  $cc =& $cache->content_config[$pane->pid];

  // indicates that the data for this pane has been built for this round of edits and need not be rebuilt
  $cc['built'] = TRUE;
  $subtype = $cc['ct_data']['subtype'] = $cache->content_types[$pane->type][$pane->subtype];
  $type = $cc['ct_data']['type'] = panels_get_content_type($pane->type);
  $cc['ignore_roles'] = !$type['role-based access'];
  if (panels_plugin_get_function('content_types', $type, 'visibility control')) {
    $cc['visibility_controller'] = $type['visibility control'];

    // defaults to NOT using the built-in pane access system if the ct defines a visibility callback
    $cc['ignore_roles'] = TRUE;
    if (isset($type['roles and visibility']) && $type['roles and visibility'] === TRUE) {
      $cc['ignore_roles'] = FALSE;
    }
  }
  if (panels_plugin_get_function('content_types', $type, 'form control')) {
    $cc['form_controller'] = $type['form control'];
  }
}