updated etxlink, ctools, colorbox, computed_field

This commit is contained in:
2019-05-13 17:51:14 +02:00
parent 33210e10f2
commit 2ffad14939
309 changed files with 4930 additions and 2655 deletions

View File

@@ -124,7 +124,7 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $
if (isset($conf['context']) && is_array($conf['context'])) {
foreach ($conf['context'] as $count => $context_info) {
if (!strpos($context_info, '.')) {
// old skool: support pre-converter contexts as well.
// Old skool: support pre-converter contexts as well.
$cid = $context_info;
$converter = '';
}
@@ -150,7 +150,7 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $
$block = new stdClass();
$block->module = 'views';
$block->delta = $view->name . '-' . $view->current_display;
$block->delta = $view->name . '-' . $view->current_display;
if (!empty($conf['link_to_view'])) {
$block->title_link = $view->get_url();
@@ -165,7 +165,7 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $
// pager type that Views uses.
if ($conf['override_pager_settings']) {
if (method_exists($view, 'init_pager')) {
// Views 3 version
// Views 3 version.
$view->set_items_per_page($conf['nodes_per_page']);
$view->set_offset($conf['offset']);
@@ -237,7 +237,7 @@ function views_content_views_select_display($form, &$form_state) {
'#type' => 'select',
'#title' => t('Display'),
'#options' => $displays,
'#description' => t('Choose which display of this view you wish to use.')
'#description' => t('Choose which display of this view you wish to use.'),
);
return $form;
@@ -271,7 +271,6 @@ function views_content_views_content_type_edit_form($form, &$form_state) {
// and check for that and forcibly set them to the right converter so that
// it doesn't get changed to some whacky default. Oooor just let it get changed
// to 'no context', I suppose.
$required = array();
if (isset($view->display_handler) && $arguments = $view->display_handler->get_handlers('argument')) {
foreach ($arguments as $arg) {
@@ -434,7 +433,7 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts)
}
if (!strpos($context_info, '.')) {
// old skool: support pre-converter contexts as well.
// Old skool: support pre-converter contexts as well.
$cid = $context_info;
$converter = '';
}
@@ -446,8 +445,10 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts)
$converters = ctools_context_get_converters($cid . '.', $contexts[$cid]);
$converter = !empty($converters[$context_info]) ? $converters[$context_info] : t('Default');
$block->content .= '<li>' . t('Argument @arg using context @context converted into @converter', array(
'@arg' => $argument->ui_name(), '@context' => $contexts[$cid]->get_identifier(),
'@converter' => $converter)) . '</li>';
'@arg' => $argument->ui_name(),
'@context' => $contexts[$cid]->get_identifier(),
'@converter' => $converter,
)) . '</li>';
}
$argument = next($arguments);
}
@@ -494,6 +495,7 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts)
* versions it was the view name with a dash and the display ID.
* If this is the case, we can use it to correct the 'display' setting
* in the $conf.
*
* @return
* The $view with the initialized display. If the $view could not be
* loaded, the name attempted will be loaded for use in errors.
@@ -534,7 +536,6 @@ function _views_content_views_update_conf(&$conf, $subtype) {
$view->set_display($display);
// $view->current_display will now reflect this value.
// If set NOT to override, go ahead and refresh from the view.
if (empty($conf['override_pager_settings'])) {
if (method_exists($view, 'init_pager')) {

View File

@@ -25,7 +25,7 @@ function views_content_views_attachments_content_type_render($subtype, $conf, $p
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_attachments';
$block->delta = $context->argument;
$block->title = '';
@@ -41,7 +41,6 @@ function views_content_views_attachments_content_type_render($subtype, $conf, $p
return $block;
}
function views_content_views_attachments_content_type_edit_form($form, &$form_state) {
$conf = $form_state['conf'];

View File

@@ -22,7 +22,7 @@ function views_content_views_empty_content_type_render($subtype, $conf, $panel_a
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_empty';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -22,7 +22,7 @@ function views_content_views_exposed_content_type_render($subtype, $conf, $panel
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_exposed';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -22,7 +22,7 @@ function views_content_views_feed_content_type_render($subtype, $conf, $panel_ar
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_feed';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -22,7 +22,7 @@ function views_content_views_footer_content_type_render($subtype, $conf, $panel_
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_footer';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -22,7 +22,7 @@ function views_content_views_header_content_type_render($subtype, $conf, $panel_
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_header';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -22,7 +22,7 @@ function views_content_views_pager_content_type_render($subtype, $conf, $panel_a
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_pager';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -143,27 +143,150 @@ function views_content_views_panes_content_type_render($subtype, $conf, $panel_a
return;
}
$conf['pane_contexts'] = $contexts;
$conf['panel_args'] = $panel_args;
$view->display_handler->set_pane_conf($conf);
$args = array();
$arguments = $view->display_handler->get_option('arguments');
$context_keys = isset($conf['context']) ? $conf['context'] : array();
foreach ($view->display_handler->get_argument_input() as $id => $argument) {
switch ($argument['type']) {
case 'context':
$key = array_shift($context_keys);
if (isset($contexts[$key])) {
if (strpos($argument['context'], '.')) {
list($context, $converter) = explode('.', $argument['context'], 2);
$args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
}
else {
$args[] = $contexts[$key]->argument;
}
}
else {
$args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
}
break;
case 'fixed':
$args[] = $argument['fixed'];
break;
case 'panel':
$args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
break;
case 'user':
$args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
break;
case 'wildcard':
// Put in the wildcard.
$args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
break;
case 'none':
default:
// Put in NULL.
// views.module knows what to do with NULL (or missing) arguments.
$args[] = NULL;
break;
}
}
// Remove any trailing NULL arguments as these are non-args:
while (count($args) && end($args) === NULL) {
array_pop($args);
}
$view->set_arguments($args);
$allow = $view->display_handler->get_option('allow');
if (!empty($conf['path'])) {
$conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
}
if ($allow['path_override'] && !empty($conf['path'])) {
$view->override_path = $conf['path'];
}
else if ($path = $view->display_handler->get_option('inherit_panels_path')) {
$view->override_path = $_GET['q'];
elseif ($path = $view->display_handler->get_option('inherit_panels_path')) {
if (drupal_is_front_page()) {
$view->override_path = '';
}
else {
$view->override_path = $_GET['q'];
}
}
$block = new stdClass();
$block->module = 'views';
$block->delta = $view->name . '-' . $display;
$block->delta = $view->name . '-' . $display;
if (($allow['link_to_view'] && !empty($conf['link_to_view'])) ||
(!$allow['link_to_view'] && $view->display_handler->get_option('link_to_view'))) {
$block->title_link = $view->get_url();
}
// More link.
if ($allow['more_link']) {
if (empty($conf['more_link'])) {
$view->display_handler->set_option('use_more', FALSE);
}
else {
$view->display_handler->set_option('use_more', TRUE);
// Make sure the view runs the count query so we know whether or not the
// more link applies.
$view->get_total_rows = TRUE;
}
}
if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
$view->set_items_per_page($conf['items_per_page']);
}
if ($allow['offset']) {
$view->set_offset($conf['offset']);
}
if ($allow['use_pager']) {
// Only set use_pager if they differ, this way we can avoid overwriting the
// pager type that Views uses.
$pager = $view->display_handler->get_option('pager');
if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
$pager['type'] = 'full';
}
elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
$pager['type'] = $view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
}
if ($conf['use_pager']) {
if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
$pager['options']['id'] = (int) $conf['pager_id'];
}
}
$view->display_handler->set_option('pager', $pager);
}
if ($allow['fields_override']) {
if ($conf['fields_override']) {
$fields = $view->get_items('field');
foreach ($fields as $field => $field_display) {
$fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
}
$view->display_handler->set_option('fields', $fields);
}
}
if ($allow['exposed_form'] && !empty($conf['exposed'])) {
foreach ($conf['exposed'] as $filter_name => $filter_value) {
if (!is_array($filter_value)) {
$conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
}
}
$view->set_exposed_input($conf['exposed']);
}
$stored_feeds = drupal_add_feed();
$block->content = $view->preview();
@@ -263,7 +386,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) {
);
}
}
if ($allow['link_to_view'] ) {
if ($allow['link_to_view']) {
$form['link_to_view'] = array(
'#type' => 'checkbox',
'#default_value' => isset($conf['link_to_view']) ? $conf['link_to_view'] : $view->display_handler->get_option('link_to_view'),
@@ -314,7 +437,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) {
$form['use_pager'] = array(
'#type' => 'checkbox',
'#title' => t('Use pager'),
'#default_value' => $conf['use_pager'],
'#default_value' => $conf['use_pager'],
'#id' => 'use-pager-checkbox',
'#prefix' => '<div class="container-inline">',
);
@@ -435,7 +558,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) {
$form['exposed']['sort_order'] = $exposed_form['sort_order'];
}
// Add the view object to the form to allow additional customization
// Add the view object to the form to allow additional customization.
$form_state['view'] = $view;
return $form;
@@ -447,7 +570,8 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) {
function views_content_views_panes_content_type_edit_form_submit(&$form, &$form_state) {
// Copy everything from our defaults.
$keys = array('link_to_view', 'more_link', 'feed_icons', 'use_pager',
'pager_id', 'items_per_page', 'offset', 'path_override', 'path', 'arguments', 'fields_override', 'exposed');
'pager_id', 'items_per_page', 'offset', 'path_override', 'path', 'arguments', 'fields_override', 'exposed',
);
foreach ($keys as $key) {
if (isset($form_state['values'][$key])) {
@@ -456,7 +580,6 @@ function views_content_views_panes_content_type_edit_form_submit(&$form, &$form_
}
}
/**
* Returns the administrative title for a type.
*/
@@ -491,21 +614,21 @@ function views_content_views_panes_content_type_admin_info($subtype, $conf, $con
$view->set_display($display_name);
views_content_views_panes_add_defaults($conf, $view);
// Add arguments first
// Add arguments first.
if (!empty($conf['arguments'])) {
$keys = array_keys($conf['arguments']);
$values = array_values($conf['arguments']);
$argument_input = $view->display_handler->get_option('argument_input');
foreach ($conf['arguments'] as $key => $value) {
if (!empty($value)){
if (!empty($value)) {
$label = $argument_input[$key]['label'];
$info[] = $label . ': ' . $value;
}
}
}
$block = new stdClass;
$block = new stdClass();
if ($info) {
$block->title = array_shift($info);

View File

@@ -35,7 +35,7 @@ function views_content_views_row_content_type_render($subtype, $conf, $panel_arg
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_row';
$block->delta = $context->argument;
$block->title = '';
@@ -91,7 +91,7 @@ function views_content_views_row_content_type_render($subtype, $conf, $panel_arg
'view' => $view,
'options' => $plugin->options,
'rows' => $rows,
'title' => $title
'title' => $title,
)
);
}

View File

@@ -22,7 +22,7 @@ function views_content_views_view_content_type_render($subtype, $conf, $panel_ar
}
// Build the content type block.
$block = new stdClass();
$block = new stdClass();
$block->module = 'views_view';
$block->delta = $context->argument;
$block->title = '';

View File

@@ -2,7 +2,6 @@
/**
* @file
*
* Plugin to provide a node context. A node context is a node wrapped in a
* context object that can be utilized by anything that accepts contexts.
*/
@@ -88,7 +87,7 @@ function views_content_context_view_create($empty, $data = NULL, $conf = FALSE,
$data->set_display($display_id);
}
}
else if (!empty($plugin['view name'])) {
elseif (!empty($plugin['view name'])) {
$data = views_get_view($plugin['view name']);
$data->set_display($plugin['view display id']);
}
@@ -101,7 +100,7 @@ function views_content_context_view_create($empty, $data = NULL, $conf = FALSE,
// $output = views_content_context_get_output($context);
// $view = $output['view'];
// @endcode
$context->data = array(
$context->data = array(
'name' => $data->name,
'display' => $data->current_display,
'args' => $data->args,
@@ -158,8 +157,7 @@ function views_content_context_view_settings_form_validate($form, &$form_state)
* Provide a list of ways that this context can be converted to a string.
*/
function views_content_context_view_convert_list() {
$list = array(
);
$list = array();
return $list;
}
@@ -171,4 +169,3 @@ function views_content_context_view_convert($context, $type) {
switch ($type) {
}
}

View File

@@ -33,7 +33,7 @@ function views_content_node_from_view_context($context, $conf, $placeholder = FA
views_content_context_get_output($context);
$row = intval($conf['row']) - 1;
if (isset($view->result[$row])) {
if (isset($view->result[$row]) && isset($view->base_field) && isset($view->result[$row]->{$view->base_field})) {
$nid = $view->result[$row]->{$view->base_field};
if ($nid) {
$node = node_load($nid);

View File

@@ -73,7 +73,7 @@ function views_content_view_from_argument_context($contexts, $conf) {
foreach ($data->display_handler->get_argument_input() as $id => $argument) {
if ($argument['type'] == 'context') {
$key = array_shift($context_keys);
if (isset($contexts [$key])) {
if (isset($contexts[$key])) {
if (strpos($argument['context'], '.')) {
list($context, $converter) = explode('.', $argument['context'], 2);
$args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
@@ -84,7 +84,7 @@ function views_content_view_from_argument_context($contexts, $conf) {
}
}
}
// remove any trailing NULL arguments as these are non-args:
// Remove any trailing NULL arguments as these are non-args:
while (count($args) && end($args) === NULL) {
array_pop($args);
}

View File

@@ -6,7 +6,7 @@
*/
/**
* Implements hook_views_plugins
* Implements hook_views_plugins().
*/
function views_content_views_plugins() {
return array(

View File

@@ -1,4 +1,5 @@
<?php
/**
* @file
* Contains the block display plugin.
@@ -14,19 +15,24 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
* If this variable is true, this display counts as a context. We use this
* variable so that we can easily build plugins against this display type.
*/
var $context_display = TRUE;
public $context_display = TRUE;
function get_style_type() { return 'context'; }
function defaultable_sections($section = NULL) {
if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin',))) {
public function get_style_type() {
return 'context';
}
public function defaultable_sections($section = NULL) {
if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin'))) {
return FALSE;
}
return parent::defaultable_sections($section);
}
function option_definition() {
public function option_definition() {
$options = parent::option_definition();
$options['admin_title'] = array('default' => '', 'translatable' => TRUE);
@@ -47,12 +53,13 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
/**
* The display block handler returns the structure necessary for a block.
*/
function execute() {
public function execute() {
$this->executing = TRUE;
return $this->view->render();
}
function preview() {
public function preview() {
$this->previewing = TRUE;
return $this->view->render();
}
@@ -60,7 +67,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
/**
* Render this display.
*/
function render() {
public function render() {
if (!empty($this->previewing)) {
return theme($this->theme_functions(), array('view' => $this->view));
}
@@ -71,7 +78,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
$hooks = theme_get_registry();
$info = $hooks[$this->definition['theme']];
if (!empty($info['file'])) {
@include_once('./' . $info['path'] . '/' . $info['file']);
@include_once './' . $info['path'] . '/' . $info['file'];
}
$this->variables = array('view' => &$this->view);
@@ -92,7 +99,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
*
* This output is returned as an array.
*/
function options_summary(&$categories, &$options) {
public function options_summary(&$categories, &$options) {
// It is very important to call the parent function here:
parent::options_summary($categories, $options);
@@ -135,7 +142,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
/**
* Provide the default form for setting options.
*/
function options_form(&$form, &$form_state) {
public function options_form(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_form($form, $form_state);
switch ($form_state['section']) {
@@ -143,6 +150,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
// This just overwrites the existing row_plugin which is using the wrong options.
$form['row_plugin']['#options'] = views_fetch_plugin_names('row', 'normal', array($this->view->base_table));
break;
case 'admin_title':
$form['#title'] .= t('Administrative title');
@@ -152,6 +160,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
'#description' => t('This is the title that will appear for this view context in the configure context dialog. If left blank, the view name will be used.'),
);
break;
case 'inherit_panels_path':
$form['#title'] .= t('Inherit path from panel display');
@@ -162,6 +171,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
'#description' => t('If yes, all links generated by Views, such as more links, summary links, and exposed input links will go to the panels display path, not the view, if the display has a path.'),
);
break;
case 'argument_input':
$form['#title'] .= t('Choose the data source for view arguments');
$argument_input = $this->get_argument_input();
@@ -216,7 +226,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function options_submit(&$form, &$form_state) {
public function options_submit(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
switch ($form_state['section']) {
@@ -234,7 +244,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
* the arguments doesn't cause the argument input field to just
* break.
*/
function get_argument_input() {
public function get_argument_input() {
$arguments = $this->get_option('argument_input');
$handlers = $this->get_handlers('argument');
@@ -260,7 +270,8 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
return $output;
}
function get_path() {
public function get_path() {
if ($this->get_option('link_display') == 'custom_url' && $override_path = $this->get_option('link_url')) {
return $override_path;
}
@@ -269,4 +280,5 @@ class views_content_plugin_display_ctools_context extends views_plugin_display {
}
return parent::get_path();
}
}

View File

@@ -8,10 +8,11 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
* If this variable is true, this display counts as a panel pane. We use
* this variable so that other modules can create alternate pane displays.
*/
var $panel_pane_display = TRUE;
var $has_pane_conf = NULL;
public $panel_pane_display = TRUE;
public $has_pane_conf = NULL;
function option_definition() {
public function option_definition() {
$options = parent::option_definition();
$options['pane_title'] = array('default' => '', 'translatable' => TRUE);
@@ -34,7 +35,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
'title_override' => array('default' => FALSE),
'exposed_form' => array('default' => FALSE),
'fields_override' => array('default' => FALSE),
),
),
);
$options['argument_input'] = array('default' => array());
@@ -44,16 +45,14 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
return $options;
}
function has_pane_conf() {
public function has_pane_conf() {
return isset($this->has_pane_conf);
}
function set_pane_conf($conf = array(), $set_cache = TRUE) {
public function set_pane_conf($conf = array()) {
$this->set_option('pane_conf', $conf);
$this->view->dom_id = !empty($this->view->dom_id) ? $this->view->dom_id : md5($this->view->name . REQUEST_TIME . rand());
if ($set_cache) {
cache_set('view_panel_pane_' . $this->view->dom_id, $conf);
}
$this->has_pane_conf = TRUE;
}
@@ -62,7 +61,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
*
* This output is returned as an array.
*/
function options_summary(&$categories, &$options) {
public function options_summary(&$categories, &$options) {
// It is very important to call the parent function here:
parent::options_summary($categories, $options);
@@ -151,7 +150,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
/**
* Provide the default form for setting options.
*/
function options_form(&$form, &$form_state) {
public function options_form(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_form($form, $form_state);
@@ -181,6 +180,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
'#options' => $options,
);
break;
case 'pane_title':
$form['#title'] .= t('Administrative title');
@@ -322,7 +322,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function options_submit(&$form, &$form_state) {
public function options_submit(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
switch ($form_state['section']) {
@@ -344,7 +344,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
* the arguments doesn't cause the argument input field to just
* break.
*/
function get_argument_input() {
public function get_argument_input() {
$arguments = $this->get_option('argument_input');
$handlers = $this->get_handlers('argument');
@@ -372,7 +372,8 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
return $output;
}
function use_more() {
public function use_more() {
$allow = $this->get_option('allow');
if (!$allow['more_link'] || !$this->has_pane_conf()) {
return parent::use_more();
@@ -381,21 +382,24 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
return (bool) $conf['more_link'];
}
function get_path() {
public function get_path() {
if (empty($this->view->override_path)) {
return parent::get_path();
}
return $this->view->override_path;
}
function get_url() {
public function get_url() {
if ($this->get_option('inherit_panels_path')) {
return $this->get_path();
}
return parent::get_url();
}
function uses_exposed_form_in_block() {
public function uses_exposed_form_in_block() {
// We'll always allow the exposed form in a block, regardless of path.
return TRUE;
}
@@ -409,160 +413,11 @@ class views_content_plugin_display_panel_pane extends views_plugin_display {
* returns, exposed filters will not be used nor
* displayed unless uses_exposed() returns TRUE.
*/
function displays_exposed() {
public function displays_exposed() {
$conf = $this->get_option('allow');
// If this is set, the exposed form is part of pane configuration, not
// rendered normally.
return empty($conf['exposed_form']);
}
/**
* Set the pane configuration options
* Done here in handler for reuse between views_content_views_panes_content_type_render
* and views_content_views_pre_view
*/
function pane_process_conf() {
ctools_include('context');
$conf = $this->get_option('pane_conf');
if (!$conf) {
// See if dom id has been cached and get conf from there.
if (!empty($this->view->dom_id) && ($cache = cache_get('view_panel_pane_' . $this->view->dom_id))) {
$conf = $cache->data;
}
if (!$conf) {
return;
}
$this->set_pane_conf($conf);
}
$contexts = $conf['pane_contexts'];
$panel_args = $conf['panel_args'];
$args = array();
$arguments = $this->get_option('arguments');
$context_keys = isset($conf['context']) ? $conf['context'] : array();
foreach ($this->get_argument_input() as $id => $argument) {
switch ($argument['type']) {
case 'context':
$key = array_shift($context_keys);
if (isset($contexts[$key])) {
if (strpos($argument['context'], '.')) {
list($context, $converter) = explode('.', $argument['context'], 2);
$args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
}
else {
$args[] = $contexts[$key]->argument;
}
}
else {
$args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
}
break;
case 'fixed':
$args[] = $argument['fixed'];
break;
case 'panel':
$args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
break;
case 'user':
$args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
break;
case 'wildcard':
// Put in the wildcard.
$args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
break;
case 'none':
default:
// Put in NULL.
// views.module knows what to do with NULL (or missing) arguments
$args[] = NULL;
break;
}
}
// remove any trailing NULL arguments as these are non-args:
while (count($args) && end($args) === NULL) {
array_pop($args);
}
$this->view->set_arguments($args);
$allow = $this->get_option('allow');
if (!empty($conf['path'])) {
$conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
}
if ($allow['path_override'] && !empty($conf['path'])) {
$this->view->override_path = $conf['path'];
}
else if ($path = $this->get_option('inherit_panels_path')) {
$this->view->override_path = $_GET['q'];
}
// more link
if ($allow['more_link']) {
if (empty($conf['more_link'])) {
$this->set_option('use_more', FALSE);
}
else {
$this->set_option('use_more', TRUE);
// make sure the view runs the count query so we know whether or not the
// more link applies.
$this->view->get_total_rows = TRUE;
}
}
if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
$this->view->set_items_per_page($conf['items_per_page']);
}
if ($allow['offset']) {
$this->view->set_offset($conf['offset']);
}
if ($allow['use_pager']) {
// Only set use_pager if they differ, this way we can avoid overwriting the
// pager type that Views uses.
$pager = $this->get_option('pager');
if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
$pager['type'] = 'full';
}
elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
$pager['type'] = $this->view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
}
if ($conf['use_pager']) {
if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
$pager['options']['id'] = (int) $conf['pager_id'];
}
}
$this->set_option('pager', $pager);
}
if ($allow['fields_override']) {
if ($conf['fields_override']) {
$fields = $this->view->get_items('field');
foreach ($fields as $field => $field_display) {
$fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
}
$this->set_option('fields', $fields);
}
}
if ($allow['exposed_form'] && !empty($conf['exposed'])) {
foreach ($conf['exposed'] as $filter_name => $filter_value) {
if (!is_array($filter_value)) {
$conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
}
}
$this->view->set_exposed_input($conf['exposed']);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @file
* Contains the default style plugin.
@@ -11,12 +12,12 @@
* @ingroup views_style_plugins
*/
class views_content_plugin_style_ctools_context extends views_plugin_style {
var $rows = array();
public $rows = array();
/**
* Render the display in this style.
*/
function render() {
public function render() {
if (!empty($this->view->display_handler->previewing)) {
return parent::render();
}

View File

@@ -5,14 +5,12 @@ dependencies[] = ctools
dependencies[] = views
core = 7.x
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
files[] = plugins/views/views_content_plugin_display_ctools_context.inc
files[] = plugins/views/views_content_plugin_display_panel_pane.inc
files[] = plugins/views/views_content_plugin_style_ctools_context.inc
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@@ -1,8 +1,7 @@
<?php
/**
* @file views_content.module
*
* @file
* Provides views as panels content, configurable by the administrator.
* Each view provided as panel content must be configured in advance,
* but once configured, building panels with views is a little bit simpler.
@@ -29,8 +28,9 @@ function views_content_menu() {
}
/**
* Implementation of hook_ctools_plugin_dierctory() to let the system know
* where our content_type plugins are.
* Implements hook_ctools_plugin_dierctory().
*
* To let the system know where our content_type plugins are.
*/
function views_content_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools') {
@@ -295,24 +295,3 @@ function views_content_get_pane_links_alter(&$links, $pane, $content_type) {
);
}
}
/**
* Implements hook_module_implements_alter()
*/
function views_content_module_implements_alter(&$implementations, $hook) {
if ($hook == 'views_pre_view') {
$group = $implementations['views_content'];
unset($implementations['views_content']);
$implementations = array('views_content' => $group) + $implementations;
}
}
/**
* Implements hook_views_pre_view()
*/
function views_content_views_pre_view(&$view) {
if (method_exists($view->display_handler, 'pane_process_conf')) {
// process the pane configuration to prevent loss when using ajax
$view->display_handler->pane_process_conf();
}
}