You are here

function template_preprocess_panels_ipe_pane_wrapper in Panels 7.3

File

panels_ipe/panels_ipe.module, line 80

Code

function template_preprocess_panels_ipe_pane_wrapper(&$vars) {
  $pane = $vars['pane'];
  $display = $vars['display'];
  $renderer = $vars['renderer'];
  $content_type = ctools_get_content_type($pane->type);
  $subtype = ctools_content_get_subtype($content_type, $pane->subtype);
  $vars['links'] = array();
  if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
    $vars['links']['edit'] = array(
      'title' => isset($content_type['edit text']) ? '<span>' . $content_type['edit text'] . '</span>' : '<span>' . t('Settings') . '</span>',
      'href' => $renderer
        ->get_url('edit-pane', $pane->pid),
      'query' => drupal_get_destination(),
      'html' => TRUE,
      'attributes' => array(
        'class' => array(
          'ctools-use-modal',
          'panels-ipe-hide-bar',
        ),
        'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
      ),
    );
  }

  // Add option to configure style in IPE.
  if (user_access('administer panels pane styles')) {
    $vars['links']['style'] = array(
      'title' => '<span>' . t('Style') . '</span>',
      'href' => $renderer
        ->get_url('style-type', 'pane', $pane->pid),
      'query' => drupal_get_destination(),
      'html' => TRUE,
      'attributes' => array(
        'class' => array(
          'ctools-use-modal',
          'panels-ipe-hide-bar',
        ),
        'title' => t('Style'),
      ),
    );
  }

  // Add option to configure CSS.
  if (user_access('administer advanced pane settings')) {
    $vars['links']['css'] = array(
      'title' => '<span>' . t('CSS') . '</span>',
      'href' => $renderer
        ->get_url('pane-css', $pane->pid),
      'query' => drupal_get_destination(),
      'html' => TRUE,
      'attributes' => array(
        'class' => array(
          'ctools-use-modal',
          'panels-ipe-hide-bar',
        ),
        'title' => t('CSS'),
      ),
    );
  }

  // Deleting is managed entirely in the js; this is just an attachment point
  // for it.
  $vars['links']['delete'] = array(
    'title' => '<span>' . t('Delete') . '</span>',
    'href' => '#',
    'html' => TRUE,
    'attributes' => array(
      'class' => 'pane-delete',
      'id' => "pane-delete-panel-pane-{$pane->pid}",
      'title' => t('Delete'),
    ),
  );
  $context = array(
    'pane' => $pane,
    'display' => $display,
    'renderer' => $renderer,
  );
  drupal_alter('panels_ipe_pane_links', $vars['links'], $context);
}