Commit 4235bf13 authored by damiankloip's avatar damiankloip Committed by tim.plunkett

Issue #1306564 by damiankloip, dawehner | gaslkn: Added Remove contextual links from rendered view.

parent 112050be
......@@ -421,6 +421,7 @@ function defaultable_sections($section = NULL) {
'css_class' => array('css_class'),
'use_ajax' => array('use_ajax'),
'hide_attachment_summary' => array('hide_attachment_summary'),
'hide_admin_links' => array('hide_admin_links'),
'group_by' => array('group_by'),
'query' => array('query'),
'use_more' => array('use_more', 'use_more_always', 'use_more_text'),
......@@ -485,6 +486,7 @@ function option_definition() {
'display_description' => FALSE,
'use_ajax' => TRUE,
'hide_attachment_summary' => TRUE,
'hide_admin_links' => FALSE,
'pager' => TRUE,
'pager_options' => TRUE,
'use_more' => TRUE,
......@@ -544,6 +546,10 @@ function option_definition() {
'default' => FALSE,
'bool' => TRUE,
),
'hide_admin_links' => array(
'default' => FALSE,
'bool' => TRUE,
),
// This is legacy code:
// Items_per/offset/use_pager is moved to the pager plugin
// but the automatic update path needs this items defined, so don't remove it.
......@@ -1224,6 +1230,14 @@ function options_summary(&$categories, &$options) {
'desc' => t('Change whether or not to display attachments when displaying a contextual filter summary.'),
);
}
if (!isset($this->definition['contextual links locations']) || !empty($this->definition['contextual links locations'])) {
$options['hide_admin_links'] = array(
'category' => 'other',
'title' => t('Hide contextual links'),
'value' => $this->get_option('hide_admin_links') ? t('Yes') : t('No'),
'desc' => t('Change whether or not to display contextual links for this view.'),
);
}
$pager_plugin = $this->get_plugin('pager');
if (!$pager_plugin) {
......@@ -1491,6 +1505,14 @@ function options_form(&$form, &$form_state) {
'#default_value' => $this->get_option('hide_attachment_summary') ? 1 : 0,
);
break;
case 'hide_admin_links':
$form['#title'] .= t('Hide contextual links on this view.');
$form['hide_admin_links'] = array(
'#type' => 'radios',
'#options' => array(1 => t('Yes'), 0 => t('No')),
'#default_value' => $this->get_option('hide_admin_links') ? 1 : 0,
);
break;
case 'use_more':
$form['#title'] .= t('Add a more link to the bottom of the display.');
$form['use_more'] = array(
......@@ -2348,6 +2370,7 @@ function options_submit(&$form, &$form_state) {
break;
case 'use_ajax':
case 'hide_attachment_summary':
case 'hide_admin_links':
$this->set_option($section, (bool)$form_state['values'][$section]);
break;
case 'use_more':
......@@ -2647,6 +2670,10 @@ function pre_execute() {
foreach ($this->extender as $extender) {
$extender->pre_execute();
}
if ($this->get_option('hide_admin_links')) {
$this->view->hide_admin_links = TRUE;
}
}
/**
......
......@@ -567,14 +567,15 @@ function hook_views_data_alter(&$data) {
* attached to this display type.
* - contextual links locations: An array with places where contextual links
* should be added. Can for example be 'page' or 'block'. If you don't
* specify it there will be contextual links around the rendered view.
* specify it there will be contextual links around the rendered view. If
* this is not set or regions have been specified, views will display an
* option to 'hide contextual links'. Use an empty array if you do not want
* this.
* - uses hook menu: Set to TRUE to have the display included by
* views_menu_alter(). views_menu_alter executes then execute_hook_menu
* on the display object.
* - uses hook block: Set to TRUE to have the display included by
* views_block_info().
* - contextual links locations: An array with places where contextual links
* should be added. Can for example be 'page' or 'block'.
* - theme: The name of a theme suggestion to use for the display.
* - js: An array with paths to js files that should be included for the
* display. Note that the path should be relative Drupal root, not module
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment