/** * Render the links to display when editing a pane. */ function get_pane_links($pane, $content_type) { $links = array(); if (!empty($pane->shown)) { $links[] = array( 'title' => t('Disable this pane'), 'href' => $this->get_url('hide', $pane->pid), 'attributes' => array('class' => array('use-ajax')), ); } else { $links[] = array( 'title' => t('Enable this pane'), 'href' => $this->get_url('show', $pane->pid), 'attributes' => array('class' => array('use-ajax')), ); } if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) { $links['panels-set-title'] = array( 'title' => t('✓Panel title'), 'html' => TRUE, ); } else { $links['panels-set-title'] = array( 'title' => t('Panel title'), 'href' => $this->get_url('panel-title', $pane->pid), 'attributes' => array('class' => array('use-ajax')), ); } $subtype = ctools_content_get_subtype($content_type, $pane->subtype); if (ctools_content_editable($content_type, $subtype, $pane->configuration)) { $links[] = array( 'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'), 'href' => $this->get_url('edit-pane', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); } if (user_access('administer advanced pane settings')) { $links[] = array( 'title' => t('CSS properties'), 'href' => $this->get_url('pane-css', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); } if (user_access('administer panels styles')) { $links[] = array( 'title' => '<hr />', 'html' => TRUE, ); $style_links = $this->get_style_links('pane', $pane->pid); $links[] = array( 'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, 'attributes' => array('class' => array('panels-sub-menu')), ); } if (user_access('administer pane access')) { $links[] = array( 'title' => '<hr />', 'html' => TRUE, ); $contexts = $this->display->context; // Make sure we have the logged in user context if (!isset($contexts['logged-in-user'])) { $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); } $visibility_links = array(); if (!empty($pane->access['plugins'])) { foreach ($pane->access['plugins'] as $id => $test) { $plugin = ctools_get_access_plugin($test['name']); $access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name'])); $access_description = ctools_access_summary($plugin, $contexts, $test); $visibility_links[] = array( 'title' => $access_description, 'href' => $this->get_url('access-configure-test', $pane->pid, $id), 'attributes' => array('class' => array('ctools-use-modal', 'panels-italic')), ); } } if (empty($visibility_links)) { $visibility_links[] = array( 'title' => t('No rules'), 'attributes' => array('class' => array('panels-text')), ); } $visibility_links[] = array( 'title' => t('Add new rule'), 'href' => $this->get_url('access-add-test', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); $visibility_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('access-settings', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); $links[] = array( 'title' => '<span class="dropdown-header">' . t('Visibility rules') . '</span>' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, 'attributes' => array('class' => array('panels-sub-menu')), ); } if (panels_get_caches() && user_access('use panels caching features')) { $links[] = array( 'title' => '<hr />', 'html' => TRUE, ); $method = isset($pane->cache['method']) ? $pane->cache['method'] : 0; $info = panels_get_cache($method); $cache_method = isset($info['title']) ? $info['title'] : t('No caching'); $cache_links[] = array( 'title' => $cache_method, 'attributes' => array('class' => array('panels-text')), ); $cache_links[] = array( 'title' => t('Change'), 'href' => $this->get_url('cache-method', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); if (panels_plugin_get_function('cache', $info, 'settings form')) { $cache_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('cache-settings', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal')), ); } $links[] = array( 'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, 'attributes' => array('class' => array('panels-sub-menu')), ); } $links[] = array( 'title' => '<hr />', 'html' => TRUE, ); $links[] = array( 'title' => t('Remove'), 'href' => '#', 'attributes' => array( 'class' => array('pane-delete'), 'id' => "pane-delete-panel-pane-$pane->pid", ), ); return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE)); }
/** * Render the links to display when editing a pane. */ function get_pane_links($pane, $content_type) { if (!empty($this->no_edit_links)) { return ''; } $links = array(); if (!empty($pane->shown)) { $links['top']['disabled'] = array('title' => t('Disable this pane'), 'href' => $this->get_url('hide', $pane->pid), 'attributes' => array('class' => array('use-ajax'))); } else { $links['top']['enable'] = array('title' => t('Enable this pane'), 'href' => $this->get_url('show', $pane->pid), 'attributes' => array('class' => array('use-ajax'))); } if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) { $links['top']['panels-set-title'] = array('title' => t('✓Panel title'), 'html' => TRUE); } else { $links['top']['panels-set-title'] = array('title' => t('Panel title'), 'href' => $this->get_url('panel-title', $pane->pid), 'attributes' => array('class' => array('use-ajax'))); } $subtype = ctools_content_get_subtype($content_type, $pane->subtype); if (ctools_content_editable($content_type, $subtype, $pane->configuration)) { $links['top']['settings'] = array('title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'), 'href' => $this->get_url('edit-pane', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); } if (user_access('administer advanced pane settings')) { $links['top']['css'] = array('title' => t('CSS properties'), 'href' => $this->get_url('pane-css', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); } if (user_access('administer panels styles')) { $links['style'] = $this->get_style_links('pane', $pane->pid); } if (user_access('administer pane access')) { $contexts = $this->display->context; // Make sure we have the logged in user context if (!isset($contexts['logged-in-user'])) { $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); } $visibility_links = array(); if (!empty($pane->access['plugins'])) { foreach ($pane->access['plugins'] as $id => $test) { $plugin = ctools_get_access_plugin($test['name']); $access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name'])); $access_description = ctools_access_summary($plugin, $contexts, $test); $visibility_links[] = array('title' => $access_description, 'href' => $this->get_url('access-configure-test', $pane->pid, $id), 'attributes' => array('class' => array('ctools-use-modal', 'panels-italic'))); } } if (empty($visibility_links)) { $visibility_links['no_rules'] = array('title' => t('No rules'), 'attributes' => array('class' => array('panels-text'))); } $visibility_links['add_rule'] = array('title' => t('Add new rule'), 'href' => $this->get_url('access-add-test', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); $visibility_links['settings'] = array('title' => t('Settings'), 'href' => $this->get_url('access-settings', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); $links['visibility'] = $visibility_links; } if (user_access('use panels locks')) { $lock_type = !empty($pane->locks['type']) ? $pane->locks['type'] : 'none'; switch ($lock_type) { case 'immovable': $lock_method = t('Immovable'); break; case 'regions': $lock_method = t('Regions'); break; case 'none': default: $lock_method = t('No lock'); break; } $lock_links['lock'] = array('title' => $lock_method, 'attributes' => array('class' => array('panels-text'))); $lock_links['change'] = array('title' => t('Change'), 'href' => $this->get_url('lock', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); $links['lock'] = $lock_links; } if (panels_get_caches() && user_access('use panels caching features')) { $method = isset($pane->cache['method']) ? $pane->cache['method'] : 0; $info = panels_get_cache($method); $cache_method = isset($info['title']) ? $info['title'] : t('No caching'); $cache_links['title'] = array('title' => $cache_method, 'attributes' => array('class' => array('panels-text'))); $cache_links['change'] = array('title' => t('Change'), 'href' => $this->get_url('cache-method', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); if (panels_plugin_get_function('cache', $info, 'settings form')) { $cache_links['settings'] = array('title' => t('Settings'), 'href' => $this->get_url('cache-settings', $pane->pid), 'attributes' => array('class' => array('ctools-use-modal'))); } $links['cache'] = $cache_links; } $links['bottom']['remove'] = array('title' => t('Remove'), 'href' => '#', 'attributes' => array('class' => array('pane-delete'), 'id' => "pane-delete-panel-pane-{$pane->pid}")); // Allow others to add/remove links from pane context menu. // Grouped by 'top', 'style', 'visibility', 'lock', 'cache' and 'bottom' drupal_alter('get_pane_links', $links, $pane, $content_type); $dropdown_links = $links['top']; $category_labels = array('style' => 'Style', 'visibility' => 'Visibility rules', 'lock' => 'Locking', 'cache' => 'Caching'); foreach ($category_labels as $category => $label) { if (array_key_exists($category, $links)) { $dropdown_links[] = array('title' => '<hr />', 'html' => TRUE); $dropdown_links[] = array('title' => '<span class="dropdown-header">' . t($label) . '</span>' . theme_links(array('links' => $links[$category], 'attributes' => array(), 'heading' => array())), 'html' => TRUE, 'attributes' => array('class' => array('panels-sub-menu'))); } } $dropdown_links[] = array('title' => '<hr />', 'html' => TRUE); $dropdown_links = array_merge($dropdown_links, $links['bottom']); return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $dropdown_links, 'image' => TRUE)); }