diff --git a/lib/Drupal/comment/Plugin/views/row/views_plugin_row_comment_rss.inc b/lib/Drupal/comment/Plugin/views/row/views_plugin_row_comment_rss.inc index a81988c4f4d8df1b57e463cb6a311c328e358794..0e096cd33dd303e74a0b26e84307d61395b72caf 100644 --- a/lib/Drupal/comment/Plugin/views/row/views_plugin_row_comment_rss.inc +++ b/lib/Drupal/comment/Plugin/views/row/views_plugin_row_comment_rss.inc @@ -88,7 +88,7 @@ function render($row) { $item_length = $this->options['item_length']; if ($item_length == 'default') { - $item_length = variable_get('feed_item_length', 'teaser'); + $item_length = config('system.rss')->get('items.view_mode'); } // Load the specified comment and its associated node: diff --git a/lib/Drupal/node/Plugin/views/argument_validate/views_plugin_argument_validate_node.inc b/lib/Drupal/node/Plugin/views/argument_validate/views_plugin_argument_validate_node.inc index 17d1708060eac6889c5f26ae1a14e05a2da71800..d031e110970d630d7bb4c91cee8625cb07e51ee4 100644 --- a/lib/Drupal/node/Plugin/views/argument_validate/views_plugin_argument_validate_node.inc +++ b/lib/Drupal/node/Plugin/views/argument_validate/views_plugin_argument_validate_node.inc @@ -98,7 +98,7 @@ function validate_argument($argument) { } // Save the title() handlers some work. - $this->argument->validated_title = check_plain($node->title); + $this->argument->validated_title = check_plain($node->label()); if (empty($types)) { return TRUE; @@ -117,8 +117,8 @@ function validate_argument($argument) { $test = drupal_map_assoc($nids->value); $titles = array(); - $result = db_query("SELECT * FROM {node} WHERE nid IN (:nids)", array(':nids' => $nids->value)); - foreach ($result as $node) { + $nodes = node_load_multiple($nids->value); + foreach ($nodes as $node) { if ($types && empty($types[$node->type])) { return FALSE; } @@ -129,7 +129,7 @@ function validate_argument($argument) { } } - $titles[] = check_plain($node->title); + $titles[] = check_plain($node->label()); unset($test[$node->nid]); } diff --git a/lib/Drupal/node/Plugin/views/row/views_plugin_row_node_rss.inc b/lib/Drupal/node/Plugin/views/row/views_plugin_row_node_rss.inc index 3d418fb325530d47ec973f9dfa9a5b4ab3c48ad0..662dc6407b8324f6a96a14e024768b50c6463867 100644 --- a/lib/Drupal/node/Plugin/views/row/views_plugin_row_node_rss.inc +++ b/lib/Drupal/node/Plugin/views/row/views_plugin_row_node_rss.inc @@ -98,7 +98,7 @@ function render($row) { $display_mode = $this->options['item_length']; if ($display_mode == 'default') { - $display_mode = variable_get('feed_item_length', 'teaser'); + $display_mode = config('system.rss')->get('items.view_mode'); } // Load the specified node: diff --git a/lib/Drupal/taxonomy/Plugin/views/argument_default/views_plugin_argument_default_taxonomy_tid.inc b/lib/Drupal/taxonomy/Plugin/views/argument_default/views_plugin_argument_default_taxonomy_tid.inc index 7ffb595efe383ecbc754c7cf99aa7732314c2e40..823b5612cb029ed239cd3798b8a4c3c79f0ca6eb 100644 --- a/lib/Drupal/taxonomy/Plugin/views/argument_default/views_plugin_argument_default_taxonomy_tid.inc +++ b/lib/Drupal/taxonomy/Plugin/views/argument_default/views_plugin_argument_default_taxonomy_tid.inc @@ -50,7 +50,7 @@ function options_form(&$form, &$form_state) { $form['limit'] = array( '#type' => 'checkbox', '#title' => t('Limit terms by vocabulary'), - '#default_value'=> $this->options['limit'], + '#default_value' => $this->options['limit'], '#states' => array( 'visible' => array( ':input[name="options[argument_default][taxonomy_tid][node]"]' => array('checked' => TRUE), @@ -80,7 +80,7 @@ function options_form(&$form, &$form_state) { $form['anyall'] = array( '#type' => 'radios', '#title' => t('Multiple-value handling'), - '#default_value'=> $this->options['anyall'], + '#default_value' => $this->options['anyall'], '#process' => array('form_process_radios', 'ctools_dependent_process'), '#options' => array( ',' => t('Filter to items that share all terms'), diff --git a/modules/aggregator/views_plugin_row_aggregator_rss.inc b/modules/aggregator/views_plugin_row_aggregator_rss.inc deleted file mode 100644 index e53781bbcaff75e844f7f4628bafa6e544c25c5f..0000000000000000000000000000000000000000 --- a/modules/aggregator/views_plugin_row_aggregator_rss.inc +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -/** - * @file - * Contains the Aggregator Item RSS row style plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which loads an aggregator item and formats it as an RSS item. - */ -class views_plugin_row_aggregator_rss extends RowPluginBase { - var $base_table = 'aggregator_item'; - var $base_field = 'iid'; - - function option_definition() { - $options = parent::option_definition(); - - $options['item_length'] = array('default' => 'default'); - - return $options; - } - - function options_form(&$form, &$form_state) { - $form['item_length'] = array( - '#type' => 'select', - '#title' => t('Display type'), - '#options' => array( - 'fulltext' => t('Full text'), - 'teaser' => t('Title plus teaser'), - 'title' => t('Title only'), - 'default' => t('Use default RSS settings'), - ), - '#default_value' => $this->options['item_length'], - ); - } - - function render($row) { - $iid = $row->{$this->field_alias}; - $sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, "; - $sql .= "ai.timestamp, ai.guid, af.title AS feed_title, ai.link AS feed_LINK "; - $sql .= "FROM {aggregator_item} ai LEFT JOIN {aggregator_feed} af ON ai.fid = af.fid "; - $sql .= "WHERE ai.iid = :iid"; - - $item = db_query($sql, array(':iid' => $iid))->fetchObject(); - - $item->elements = array( - array( - 'key' => 'pubDate', - 'value' => gmdate('r', $item->timestamp), - ), - array( - 'key' => 'dc:creator', - 'value' => $item->author, - ), - array( - 'key' => 'guid', - 'value' => $item->guid, - 'attributes' => array('isPermaLink' => 'false') - ), - ); - - foreach ($item->elements as $element) { - if (isset($element['namespace'])) { - $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $element['namespace']); - } - } - - return theme($this->theme_functions(), array( - 'view' => $this->view, - 'options' => $this->options, - 'row' => $item - )); - } -} diff --git a/modules/book/views_plugin_argument_default_book_root.inc b/modules/book/views_plugin_argument_default_book_root.inc deleted file mode 100644 index 22e14f7a3822ef8c1056f03b0716851c8e5fac20..0000000000000000000000000000000000000000 --- a/modules/book/views_plugin_argument_default_book_root.inc +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * @file - * Contains the book root from current node argument default plugin. - */ - -use Drupal\views\Plugins\views\argument_default\Node; - -/** - * Default argument plugin to get the current node's book root. - */ -class views_plugin_argument_default_book_root extends Node { - function get_argument() { - // Use the argument_default_node plugin to get the nid argument. - $nid = parent::get_argument(); - if (!empty($nid)) { - $node = node_load($nid); - if (isset($node->book['bid'])) { - return $node->book['bid']; - } - } - } -} diff --git a/modules/comment/views_plugin_row_comment_rss.inc b/modules/comment/views_plugin_row_comment_rss.inc deleted file mode 100644 index 0e096cd33dd303e74a0b26e84307d61395b72caf..0000000000000000000000000000000000000000 --- a/modules/comment/views_plugin_row_comment_rss.inc +++ /dev/null @@ -1,154 +0,0 @@ -<?php - -/** - * @file - * Contains the comment RSS row style plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which formats the comments as RSS items. - */ -class views_plugin_row_comment_rss extends RowPluginBase { - var $base_table = 'comment'; - var $base_field = 'cid'; - - function option_definition() { - $options = parent::option_definition(); - - $options['item_length'] = array('default' => 'default'); - $options['links'] = array('default' => FALSE, 'bool' => TRUE); - - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['item_length'] = array( - '#type' => 'select', - '#title' => t('Display type'), - '#options' => $this->options_form_summary_options(), - '#default_value' => $this->options['item_length'], - ); - $form['links'] = array( - '#type' => 'checkbox', - '#title' => t('Display links'), - '#default_value' => $this->options['links'], - ); - } - - - function pre_render($result) { - $cids = array(); - $nids = array(); - - foreach ($result as $row) { - $cids[] = $row->cid; - } - - $this->comments = comment_load_multiple($cids); - foreach ($this->comments as &$comment) { - $comment->depth = count(explode('.', $comment->thread)) - 1; - $nids[] = $comment->nid; - } - - $this->nodes = node_load_multiple($nids); - } - - /** - * Return the main options, which are shown in the summary title - * - * @see views_plugin_row_node_rss::options_form_summary_options() - * @todo: Maybe provide a views_plugin_row_rss_entity and reuse this method - * in views_plugin_row_comment|node_rss.inc - */ - function options_form_summary_options() { - $entity_info = entity_get_info('node'); - $options = array(); - if (!empty($entity_info['view modes'])) { - foreach ($entity_info['view modes'] as $mode => $settings) { - $options[$mode] = $settings['label']; - } - } - $options['title'] = t('Title only'); - $options['default'] = t('Use site default RSS settings'); - return $options; - } - - - function render($row) { - global $base_url; - - $cid = $row->{$this->field_alias}; - if (!is_numeric($cid)) { - return; - } - - $item_length = $this->options['item_length']; - if ($item_length == 'default') { - $item_length = config('system.rss')->get('items.view_mode'); - } - - // Load the specified comment and its associated node: - $comment = $this->comments[$cid]; - if (empty($comment) || empty($this->nodes[$comment->nid])) { - return; - } - - $item_text = ''; - - $uri = $comment->uri(); - $comment->link = url($uri['path'], $uri['options'] + array('absolute' => TRUE)); - $comment->rss_namespaces = array(); - $comment->rss_elements = array( - array( - 'key' => 'pubDate', - 'value' => gmdate('r', $comment->created), - ), - array( - 'key' => 'dc:creator', - 'value' => $comment->name, - ), - array( - 'key' => 'guid', - 'value' => 'comment ' . $comment->cid . ' at ' . $base_url, - 'attributes' => array('isPermaLink' => 'false'), - ), - ); - - // The comment gets built and modules add to or modify - // $comment->rss_elements and $comment->rss_namespaces. - $build = comment_view($comment, $this->nodes[$comment->nid], 'rss'); - unset($build['#theme']); - - if (!empty($comment->rss_namespaces)) { - $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces); - } - - // Hide the links if desired. - if (!$this->options['links']) { - hide($build['links']); - } - - if ($item_length != 'title') { - // We render comment contents and force links to be last. - $build['links']['#weight'] = 1000; - $item_text .= drupal_render($build); - } - - $item = new stdClass(); - $item->description = $item_text; - $item->title = $comment->subject; - $item->link = $comment->link; - $item->elements = $comment->rss_elements; - $item->cid = $comment->cid; - - return theme($this->theme_functions(), array( - 'view' => $this->view, - 'options' => $this->options, - 'row' => $item - )); - } -} diff --git a/modules/comment/views_plugin_row_comment_view.inc b/modules/comment/views_plugin_row_comment_view.inc deleted file mode 100644 index c53602f05171d0d57c96da9ee2fb7f50f2a429bb..0000000000000000000000000000000000000000 --- a/modules/comment/views_plugin_row_comment_view.inc +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -/** - * @file - * Contains the node RSS row style plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which performs a comment_view on the resulting object. - */ -class views_plugin_row_comment_view extends RowPluginBase { - var $base_field = 'cid'; - var $base_table = 'comment'; - - /** - * Stores all comments which are preloaded. - */ - var $comments = array(); - - /** - * Stores all nodes of all comments which are preloaded. - */ - var $nodes = array(); - - function summary_title() { - return t('Settings'); - } - - function option_definition() { - $options = parent::option_definition(); - $options['links'] = array('default' => TRUE, 'bool' => TRUE); - $options['view_mode'] = array('default' => 'full'); - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $options = $this->options_form_summary_options(); - $form['view_mode'] = array( - '#type' => 'select', - '#options' => $options, - '#title' => t('View mode'), - '#default_value' => $this->options['view_mode'], - ); - - $form['links'] = array( - '#type' => 'checkbox', - '#title' => t('Display links'), - '#default_value' => $this->options['links'], - ); - } - - - /** - * Return the main options, which are shown in the summary title. - */ - function options_form_summary_options() { - $entity_info = entity_get_info('comment'); - $options = array(); - if (!empty($entity_info['view modes'])) { - foreach ($entity_info['view modes'] as $mode => $settings) { - $options[$mode] = $settings['label']; - } - } - if (empty($options)) { - $options = array( - 'full' => t('Full content') - ); - } - - return $options; - } - - function pre_render($result) { - $cids = array(); - - foreach ($result as $row) { - $cids[] = $row->cid; - } - - // Load all comments. - $cresult = comment_load_multiple($cids); - $nids = array(); - foreach ($cresult as $comment) { - $comment->depth = count(explode('.', $comment->thread)) - 1; - $this->comments[$comment->cid] = $comment; - $nids[] = $comment->nid; - } - - // Load all nodes of the comments. - $nodes = node_load_multiple(array_unique($nids)); - foreach ($nodes as $node) { - $this->nodes[$node->nid] = $node; - } - } -} diff --git a/modules/node/views_plugin_argument_default_node.inc b/modules/node/views_plugin_argument_default_node.inc deleted file mode 100644 index b7fb1282a7cd605d2d38c041d00f829728120fe1..0000000000000000000000000000000000000000 --- a/modules/node/views_plugin_argument_default_node.inc +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/** - * @file - * Contains the node from URL argument default plugin. - */ - -use Drupal\views\Plugins\views\argument_default\ArgumentDefaultPluginBase; - -/** - * Default argument plugin to extract a node via menu_get_object - * - * This plugin actually has no options so it odes not need to do a great deal. - */ -class views_plugin_argument_default_node extends ArgumentDefaultPluginBase { - function get_argument() { - foreach (range(1, 3) as $i) { - $node = menu_get_object('node', $i); - if (!empty($node)) { - return $node->nid; - } - } - - if (arg(0) == 'node' && is_numeric(arg(1))) { - return arg(1); - } - } -} diff --git a/modules/node/views_plugin_argument_validate_node.inc b/modules/node/views_plugin_argument_validate_node.inc deleted file mode 100644 index d031e110970d630d7bb4c91cee8625cb07e51ee4..0000000000000000000000000000000000000000 --- a/modules/node/views_plugin_argument_validate_node.inc +++ /dev/null @@ -1,141 +0,0 @@ -<?php - -/** - * @file - * Contains the 'node' argument validator plugin. - */ - -use Drupal\views\Plugins\views\argument_validator\ArgumentValidatorPluginBase; - -/** - * Validate whether an argument is an acceptable node. - */ -class views_plugin_argument_validate_node extends ArgumentValidatorPluginBase { - function option_definition() { - $options = parent::option_definition(); - $options['types'] = array('default' => array()); - $options['access'] = array('default' => FALSE, 'bool' => TRUE); - $options['access_op'] = array('default' => 'view'); - $options['nid_type'] = array('default' => 'nid'); - - return $options; - } - - function options_form(&$form, &$form_state) { - $types = node_type_get_types(); - $options = array(); - foreach ($types as $type => $info) { - $options[$type] = check_plain(t($info->name)); - } - - $form['types'] = array( - '#type' => 'checkboxes', - '#title' => t('Content types'), - '#options' => $options, - '#default_value' => $this->options['types'], - '#description' => t('Choose one or more content types to validate with.'), - ); - - $form['access'] = array( - '#type' => 'checkbox', - '#title' => t('Validate user has access to the content'), - '#default_value' => $this->options['access'], - ); - $form['access_op'] = array( - '#type' => 'radios', - '#title' => t('Access operation to check'), - '#options' => array('view' => t('View'), 'update' => t('Edit'), 'delete' => t('Delete')), - '#default_value' => $this->options['access_op'], - '#states' => array( - 'visible' => array( - ':input[name="options[validate][options][node][access]"]' => array('checked' => TRUE), - ), - ), - ); - - $form['nid_type'] = array( - '#type' => 'select', - '#title' => t('Filter value format'), - '#options' => array( - 'nid' => t('Node ID'), - 'nids' => t('Node IDs separated by , or +'), - ), - '#default_value' => $this->options['nid_type'], - ); - } - - function options_submit(&$form, &$form_state, &$options = array()) { - // filter trash out of the options so we don't store giant unnecessary arrays - $options['types'] = array_filter($options['types']); - } - - function convert_options(&$options) { - if (!isset($options['types']) && !empty($this->argument->options['validate_argument_node_type'])) { - $options['types'] = isset($this->argument->options['validate_argument_node_type']) ? $this->argument->options['validate_argument_node_type'] : array(); - $options['access'] = !empty($this->argument->options['validate_argument_node_access']); - $options['access_op'] = isset($this->argument->options['validate_argument_node_access_op']) ? $this->argument->options['validate_argument_node_access_op'] : 'view'; - $options['nid_type'] = isset($this->argument->options['validate_argument_nid_type']) ? $this->argument->options['validate_argument_nid_type'] : array(); - } - } - - function validate_argument($argument) { - $types = $this->options['types']; - - switch ($this->options['nid_type']) { - case 'nid': - if (!is_numeric($argument)) { - return FALSE; - } - $node = node_load($argument); - if (!$node) { - return FALSE; - } - - if (!empty($this->options['access'])) { - if (!node_access($this->options['access_op'], $node)) { - return FALSE; - } - } - - // Save the title() handlers some work. - $this->argument->validated_title = check_plain($node->label()); - - if (empty($types)) { - return TRUE; - } - - return isset($types[$node->type]); - break; - case 'nids': - $nids = new stdClass(); - $nids->value = array($argument); - $nids = views_break_phrase($argument, $nids); - if ($nids->value == array(-1)) { - return FALSE; - } - - $test = drupal_map_assoc($nids->value); - $titles = array(); - - $nodes = node_load_multiple($nids->value); - foreach ($nodes as $node) { - if ($types && empty($types[$node->type])) { - return FALSE; - } - - if (!empty($this->options['access'])) { - if (!node_access($this->options['access_op'], $node)) { - return FALSE; - } - } - - $titles[] = check_plain($node->label()); - unset($test[$node->nid]); - } - - $this->argument->validated_title = implode($nids->operator == 'or' ? ' + ' : ', ', $titles); - // If this is not empty, we did not find a nid. - return empty($test); - } - } -} diff --git a/modules/node/views_plugin_row_node_rss.inc b/modules/node/views_plugin_row_node_rss.inc deleted file mode 100644 index 662dc6407b8324f6a96a14e024768b50c6463867..0000000000000000000000000000000000000000 --- a/modules/node/views_plugin_row_node_rss.inc +++ /dev/null @@ -1,176 +0,0 @@ -<?php - -/** - * @file - * Contains the node RSS row style plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which performs a node_view on the resulting object - * and formats it as an RSS item. - */ -class views_plugin_row_node_rss extends RowPluginBase { - // Basic properties that let the row style follow relationships. - var $base_table = 'node'; - var $base_field = 'nid'; - - // Stores the nodes loaded with pre_render. - var $nodes = array(); - - function option_definition() { - $options = parent::option_definition(); - - $options['item_length'] = array('default' => 'default'); - $options['links'] = array('default' => FALSE, 'bool' => TRUE); - - return $options; - } - - /** - * Override init function to convert fulltext view-mode to full. - */ - function init(&$view, &$display, $options = NULL) { - parent::init($view, $display, $options); - - if ($this->options['item_length'] == 'fulltext') { - $this->options['item_length'] = 'full'; - } - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['item_length'] = array( - '#type' => 'select', - '#title' => t('Display type'), - '#options' => $this->options_form_summary_options(), - '#default_value' => $this->options['item_length'], - ); - $form['links'] = array( - '#type' => 'checkbox', - '#title' => t('Display links'), - '#default_value' => $this->options['links'], - ); - } - - /** - * Return the main options, which are shown in the summary title. - */ - function options_form_summary_options() { - $entity_info = entity_get_info('node'); - $options = array(); - if (!empty($entity_info['view modes'])) { - foreach ($entity_info['view modes'] as $mode => $settings) { - $options[$mode] = $settings['label']; - } - } - $options['title'] = t('Title only'); - $options['default'] = t('Use site default RSS settings'); - return $options; - } - - function summary_title() { - $options = $this->options_form_summary_options(); - return check_plain($options[$this->options['item_length']]); - } - - - function pre_render($values) { - $nids = array(); - foreach ($values as $row) { - $nids[] = $row->{$this->field_alias}; - } - if (!empty($nids)) { - $this->nodes = node_load_multiple($nids); - } - } - - function render($row) { - // For the most part, this code is taken from node_feed() in node.module - global $base_url; - - $nid = $row->{$this->field_alias}; - if (!is_numeric($nid)) { - return; - } - - $display_mode = $this->options['item_length']; - if ($display_mode == 'default') { - $display_mode = config('system.rss')->get('items.view_mode'); - } - - // Load the specified node: - $node = $this->nodes[$nid]; - if (empty($node)) { - return; - } - - $item_text = ''; - - $uri = $node->uri(); - $node->link = url($uri['path'], $uri['options'] + array('absolute' => TRUE)); - $node->rss_namespaces = array(); - $node->rss_elements = array( - array( - 'key' => 'pubDate', - 'value' => gmdate('r', $node->created), - ), - array( - 'key' => 'dc:creator', - 'value' => $node->name, - ), - array( - 'key' => 'guid', - 'value' => $node->nid . ' at ' . $base_url, - 'attributes' => array('isPermaLink' => 'false'), - ), - ); - - // The node gets built and modules add to or modify $node->rss_elements - // and $node->rss_namespaces. - - $build_mode = $display_mode; - - $build = node_view($node, $build_mode); - unset($build['#theme']); - - if (!empty($node->rss_namespaces)) { - $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $node->rss_namespaces); - } - elseif (function_exists('rdf_get_namespaces')) { - // Merge RDF namespaces in the XML namespaces in case they are used - // further in the RSS content. - $xml_rdf_namespaces = array(); - foreach (rdf_get_namespaces() as $prefix => $uri) { - $xml_rdf_namespaces['xmlns:' . $prefix] = $uri; - } - $this->view->style_plugin->namespaces += $xml_rdf_namespaces; - } - - // Hide the links if desired. - if (!$this->options['links']) { - hide($build['links']); - } - - if ($display_mode != 'title') { - // We render node contents and force links to be last. - $build['links']['#weight'] = 1000; - $item_text .= drupal_render($build); - } - - $item = new stdClass(); - $item->description = $item_text; - $item->title = $node->title; - $item->link = $node->link; - $item->elements = $node->rss_elements; - $item->nid = $node->nid; - - return theme($this->theme_functions(), array( - 'view' => $this->view, - 'options' => $this->options, - 'row' => $item - )); - } -} diff --git a/modules/node/views_plugin_row_node_view.inc b/modules/node/views_plugin_row_node_view.inc deleted file mode 100644 index 1ae2008a5b2ba605f914ae7ed74fcae6ba050221..0000000000000000000000000000000000000000 --- a/modules/node/views_plugin_row_node_view.inc +++ /dev/null @@ -1,110 +0,0 @@ -<?php - -/** - * @file - * Contains the node view row style plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which performs a node_view on the resulting object. - * - * Most of the code on this object is in the theme function. - * - * @ingroup views_row_plugins - */ -class views_plugin_row_node_view extends RowPluginBase { - // Basic properties that let the row style follow relationships. - var $base_table = 'node'; - var $base_field = 'nid'; - - // Stores the nodes loaded with pre_render. - var $nodes = array(); - - function init(&$view, &$display, $options = NULL) { - parent::init($view, $display, $options); - // Handle existing views with the deprecated 'teaser' option. - if (isset($this->options['teaser'])) { - $this->options['build_mode'] = $this->options['teaser'] ? 'teaser' : 'full'; - } - // Handle existing views which has used build_mode instead of view_mode. - if (isset($this->options['build_mode'])) { - $this->options['view_mode'] = $this->options['build_mode']; - } - } - - function option_definition() { - $options = parent::option_definition(); - - $options['view_mode'] = array('default' => 'teaser'); - $options['links'] = array('default' => TRUE, 'bool' => TRUE); - $options['comments'] = array('default' => FALSE, 'bool' => TRUE); - - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $options = $this->options_form_summary_options(); - $form['view_mode'] = array( - '#type' => 'select', - '#options' => $options, - '#title' => t('View mode'), - '#default_value' => $this->options['view_mode'], - ); - $form['links'] = array( - '#type' => 'checkbox', - '#title' => t('Display links'), - '#default_value' => $this->options['links'], - ); - $form['comments'] = array( - '#type' => 'checkbox', - '#title' => t('Display comments'), - '#default_value' => $this->options['comments'], - ); - } - - /** - * Return the main options, which are shown in the summary title. - */ - function options_form_summary_options() { - $entity_info = entity_get_info('node'); - $options = array(); - if (!empty($entity_info['view modes'])) { - foreach ($entity_info['view modes'] as $mode => $settings) { - $options[$mode] = $settings['label']; - } - } - if (empty($options)) { - $options = array( - 'teaser' => t('Teaser'), - 'full' => t('Full content') - ); - } - - return $options; - } - - function summary_title() { - $options = $this->options_form_summary_options(); - return check_plain($options[$this->options['view_mode']]); - } - - function pre_render($values) { - $nids = array(); - foreach ($values as $row) { - $nids[] = $row->{$this->field_alias}; - } - $this->nodes = node_load_multiple($nids); - } - - function render($row) { - $node = $this->nodes[$row->{$this->field_alias}]; - $node->view = $this->view; - $build = node_view($node, $this->options['view_mode']); - - return drupal_render($build); - } -} diff --git a/modules/search/views_plugin_row_search_view.inc b/modules/search/views_plugin_row_search_view.inc deleted file mode 100644 index b33852aea8f2f095e6ac75f3e57a743af7224659..0000000000000000000000000000000000000000 --- a/modules/search/views_plugin_row_search_view.inc +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/** - * @file - * Definition of views_plugin_row_search_view. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * Plugin which performs a node_view on the resulting object. - */ -class views_plugin_row_search_view extends RowPluginBase { - function option_definition() { - $options = parent::option_definition(); - - $options['score'] = array('default' => TRUE, 'bool' => TRUE); - - return $options; - } - - function options_form(&$form, &$form_state) { - $form['score'] = array( - '#type' => 'checkbox', - '#title' => t('Display score'), - '#default_value' => $this->options['score'], - ); - } - - /** - * Override the behavior of the render() function. - */ - function render($row) { - return theme($this->theme_functions(), - array( - 'view' => $this->view, - 'options' => $this->options, - 'row' => $row - )); - } -} diff --git a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc b/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc deleted file mode 100644 index 823b5612cb029ed239cd3798b8a4c3c79f0ca6eb..0000000000000000000000000000000000000000 --- a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc +++ /dev/null @@ -1,156 +0,0 @@ -<?php - -/** - * @file - * Definition of views_plugin_argument_default_taxonomy_tid. - */ - -/** - * Taxonomy tid default argument. - */ -class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_default { - function init(&$view, &$argument, $options) { - parent::init($view, $argument, $options); - - // Convert legacy vids option to machine name vocabularies. - if (!empty($this->options['vids'])) { - $vocabularies = taxonomy_vocabulary_get_names(); - foreach ($this->options['vids'] as $vid) { - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name; - } - } - } - } - - function option_definition() { - $options = parent::option_definition(); - - $options['term_page'] = array('default' => TRUE, 'bool' => TRUE); - $options['node'] = array('default' => FALSE, 'bool' => TRUE); - $options['anyall'] = array('default' => ','); - $options['limit'] = array('default' => FALSE, 'bool' => TRUE); - $options['vocabularies'] = array('default' => array()); - - return $options; - } - - function options_form(&$form, &$form_state) { - $form['term_page'] = array( - '#type' => 'checkbox', - '#title' => t('Load default filter from term page'), - '#default_value' => $this->options['term_page'], - ); - $form['node'] = array( - '#type' => 'checkbox', - '#title' => t('Load default filter from node page, that\'s good for related taxonomy blocks'), - '#default_value' => $this->options['node'], - ); - - $form['limit'] = array( - '#type' => 'checkbox', - '#title' => t('Limit terms by vocabulary'), - '#default_value' => $this->options['limit'], - '#states' => array( - 'visible' => array( - ':input[name="options[argument_default][taxonomy_tid][node]"]' => array('checked' => TRUE), - ), - ), - ); - - $options = array(); - $vocabularies = taxonomy_vocabulary_get_names(); - foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); - } - - $form['vocabularies'] = array( - '#type' => 'checkboxes', - '#title' => t('Vocabularies'), - '#options' => $options, - '#default_value' => $this->options['vocabularies'], - '#states' => array( - 'visible' => array( - ':input[name="options[argument_default][taxonomy_tid][limit]"]' => array('checked' => TRUE), - ':input[name="options[argument_default][taxonomy_tid][node]"]' => array('checked' => TRUE), - ), - ), - ); - - $form['anyall'] = array( - '#type' => 'radios', - '#title' => t('Multiple-value handling'), - '#default_value' => $this->options['anyall'], - '#process' => array('form_process_radios', 'ctools_dependent_process'), - '#options' => array( - ',' => t('Filter to items that share all terms'), - '+' => t('Filter to items that share any term'), - ), - '#states' => array( - 'visible' => array( - ':input[name="options[argument_default][taxonomy_tid][node]"]' => array('checked' => TRUE), - ), - ), - ); - } - - function options_submit(&$form, &$form_state, &$options = array()) { - // Filter unselected items so we don't unnecessarily store giant arrays. - $options['vocabularies'] = array_filter($options['vocabularies']); - } - - function get_argument() { - // Load default argument from taxonomy page. - if (!empty($this->options['term_page'])) { - if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) { - return arg(2); - } - } - // Load default argument from node. - if (!empty($this->options['node'])) { - foreach (range(1, 3) as $i) { - $node = menu_get_object('node', $i); - if (!empty($node)) { - break; - } - } - // Just check, if a node could be detected. - if ($node) { - $taxonomy = array(); - $fields = field_info_instances('node', $node->type); - foreach ($fields as $name => $info) { - $field_info = field_info_field($name); - if ($field_info['type'] == 'taxonomy_term_reference') { - $items = field_get_items('node', $node, $name); - if (is_array($items)) { - foreach ($items as $item) { - $taxonomy[$item['tid']] = $field_info['settings']['allowed_values'][0]['vocabulary']; - } - } - } - } - if (!empty($this->options['limit'])) { - $tids = array(); - // filter by vocabulary - foreach ($taxonomy as $tid => $vocab) { - if (!empty($this->options['vocabularies'][$vocab])) { - $tids[] = $tid; - } - } - return implode($this->options['anyall'], $tids); - } - // Return all tids. - else { - return implode($this->options['anyall'], array_keys($taxonomy)); - } - } - } - - // If the current page is a view that takes tid as an argument, - // find the tid argument and return it. - $views_page = views_get_page_view(); - if ($views_page && isset($views_page->argument['tid'])) { - return $views_page->argument['tid']->argument; - } - } -} diff --git a/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc b/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc deleted file mode 100644 index a324a011704b84ec97569897e266593349d9824d..0000000000000000000000000000000000000000 --- a/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc +++ /dev/null @@ -1,222 +0,0 @@ -<?php - -/** - * @file - * Contains the 'taxonomy term' argument validator plugin. - */ - -/** - * Validate whether an argument is an acceptable node. - */ -class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument_validate { - function init(&$view, &$argument, $options) { - parent::init($view, $argument, $options); - - // Convert legacy vids option to machine name vocabularies. - if (!empty($this->options['vids'])) { - $vocabularies = taxonomy_vocabulary_get_names(); - foreach ($this->options['vids'] as $vid) { - if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) { - $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name; - } - } - } - } - - function option_definition() { - $options = parent::option_definition(); - $options['vocabularies'] = array('default' => array()); - $options['type'] = array('default' => 'tid'); - $options['transform'] = array('default' => FALSE, 'bool' => TRUE); - - return $options; - } - - function options_form(&$form, &$form_state) { - $vocabularies = taxonomy_vocabulary_get_names(); - $options = array(); - foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); - } - - $form['vocabularies'] = array( - '#type' => 'checkboxes', - '#prefix' => '<div id="edit-options-validate-argument-vocabulary-wrapper">', - '#suffix' => '</div>', - '#title' => t('Vocabularies'), - '#options' => $options, - '#default_value' => $this->options['vocabularies'], - '#description' => t('If you wish to validate for specific vocabularies, check them; if none are checked, all terms will pass.'), - ); - - $form['type'] = array( - '#type' => 'select', - '#title' => t('Filter value type'), - '#options' => array( - 'tid' => t('Term ID'), - 'tids' => t('Term IDs separated by , or +'), - 'name' => t('Term name'), - 'convert' => t('Term name converted to Term ID'), - ), - '#default_value' => $this->options['type'], - '#description' => t('Select the form of this filter value; if using term name, it is generally more efficient to convert it to a term ID and use Taxonomy: Term ID rather than Taxonomy: Term Name" as the filter.'), - ); - - $form['transform'] = array( - '#type' => 'checkbox', - '#title' => t('Transform dashes in URL to spaces in term name filter values'), - '#default_value' => $this->options['transform'], - ); - } - - function options_submit(&$form, &$form_state, &$options = array()) { - // Filter unselected items so we don't unnecessarily store giant arrays. - $options['vocabularies'] = array_filter($options['vocabularies']); - } - - function convert_options(&$options) { - if (!isset($options['vocabularies']) && !empty($this->argument->options['validate_argument_vocabulary'])) { - $options['vocabularies'] = $this->argument->options['validate_argument_vocabulary']; - $options['type'] = $this->argument->options['validate_argument_type']; - $options['transform'] = isset($this->argument->options['validate_argument_transform']) ? $this->argument->options['validate_argument_transform'] : FALSE; - } - } - - function validate_argument($argument) { - $vocabularies = array_filter($this->options['vocabularies']); - $type = $this->options['type']; - $transform = $this->options['transform']; - - switch ($type) { - case 'tid': - if (!is_numeric($argument)) { - return FALSE; - } - - $query = db_select('taxonomy_term_data', 'td'); - $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); - $query->fields('td'); - $query->fields('tv', array('machine_name')); - $query->condition('td.tid', $argument); - $query->addTag('term_access'); - $term = $query->execute()->fetchObject(); - if (!$term) { - return FALSE; - } - $this->argument->validated_title = check_plain($term->name); - return empty($vocabularies) || !empty($vocabularies[$term->machine_name]); - - case 'tids': - // An empty argument is not a term so doesn't pass. - if (empty($argument)) { - return FALSE; - } - - $tids = new stdClass(); - $tids->value = $argument; - $tids = views_break_phrase($argument, $tids); - if ($tids->value == array(-1)) { - return FALSE; - } - - $test = drupal_map_assoc($tids->value); - $titles = array(); - - // check, if some tids already verified - static $validated_cache = array(); - foreach ($test as $tid) { - if (isset($validated_cache[$tid])) { - if ($validated_cache[$tid] === FALSE) { - return FALSE; - } - else { - $titles[] = $validated_cache[$tid]; - unset($test[$tid]); - } - } - } - - // if unverified tids left - verify them and cache results - if (count($test)) { - $query = db_select('taxonomy_term_data', 'td'); - $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); - $query->fields('td'); - $query->fields('tv', array('machine_name')); - $query->condition('td.tid', $test); - - $result = $query->execute(); - - foreach ($result as $term) { - if ($vocabularies && empty($vocabularies[$term->machine_name])) { - $validated_cache[$term->tid] = FALSE; - return FALSE; - } - - $titles[] = $validated_cache[$term->tid] = check_plain($term->name); - unset($test[$term->tid]); - } - } - - // Remove duplicate titles - $titles = array_unique($titles); - - $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles); - // If this is not empty, we did not find a tid. - return empty($test); - - case 'name': - case 'convert': - $query = db_select('taxonomy_term_data', 'td'); - $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); - $query->fields('td'); - $query->fields('tv', array('machine_name')); - if (!empty($vocabularies)) { - $query->condition('tv.machine_name', $vocabularies); - } - if ($transform) { - $query->where("replace(td.name, ' ', '-') = :name", array(':name' => $argument)); - } - else { - $query->condition('td.name', $argument); - } - $term = $query->execute()->fetchObject(); - - if ($term && (empty($vocabularies) || !empty($vocabularies[$term->machine_name]))) { - if ($type == 'convert') { - $this->argument->argument = $term->tid; - } - $this->argument->validated_title = check_plain($term->name); - return TRUE; - } - return FALSE; - } - } - - function process_summary_arguments(&$args) { - $type = $this->options['type']; - $transform = $this->options['transform']; - $vocabularies = array_filter($this->options['vocabularies']); - - if ($type == 'convert') { - $arg_keys = array_flip($args); - - $query = db_select('taxonomy_term_data', 'td'); - $query->condition('tid', $args); - $query->addField('td', 'tid', 'tid'); - if (!empty($vocabularies)) { - $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); - $query->condition('tv.machine_name', $vocabularies); - } - if ($transform) { - $query->addExpression("REPLACE(td.name, ' ', '-')", 'name'); - } - else { - $query->addField('td', 'name', 'name'); - } - - foreach ($query->execute()->fetchAllKeyed() as $tid => $term) { - $args[$arg_keys[$tid]] = $term; - } - } - } -} diff --git a/modules/user/views_plugin_argument_default_current_user.inc b/modules/user/views_plugin_argument_default_current_user.inc deleted file mode 100644 index 0b10ec066fddcaae9aec5e68ccf65362d28b6c93..0000000000000000000000000000000000000000 --- a/modules/user/views_plugin_argument_default_current_user.inc +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/** - * @file - * Contains the current user argument default plugin. - */ - -use Drupal\views\Plugins\views\argument_default\ArgumentDefaultPluginBase; - -/** - * Default argument plugin to extract the global $user - * - * This plugin actually has no options so it odes not need to do a great deal. - */ -class views_plugin_argument_default_current_user extends ArgumentDefaultPluginBase { - function get_argument() { - global $user; - return $user->uid; - } -} diff --git a/modules/user/views_plugin_argument_default_user.inc b/modules/user/views_plugin_argument_default_user.inc deleted file mode 100644 index 02764f21ff7ea23e627fb49c3f27eaac6231d307..0000000000000000000000000000000000000000 --- a/modules/user/views_plugin_argument_default_user.inc +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -/** - * @file - * Contains the user from URL argument default plugin. - */ - -use Drupal\views\Plugins\views\argument_default\ArgumentDefaultPluginBase; - -/** - * Default argument plugin to extract a user via menu_get_object. - */ -class views_plugin_argument_default_user extends ArgumentDefaultPluginBase { - function option_definition() { - $options = parent::option_definition(); - $options['user'] = array('default' => '', 'bool' => TRUE, 'translatable' => FALSE); - - return $options; - } - - function options_form(&$form, &$form_state) { - $form['user'] = array( - '#type' => 'checkbox', - '#title' => t('Also look for a node and use the node author'), - '#default_value' => $this->options['user'], - ); - } - - function convert_options(&$options) { - if (!isset($options['user']) && isset($this->argument->options['default_argument_user'])) { - $options['user'] = $this->argument->options['default_argument_user']; - } - } - - function get_argument() { - foreach (range(1, 3) as $i) { - $user = menu_get_object('user', $i); - if (!empty($user)) { - return $user->uid; - } - } - - foreach (range(1, 3) as $i) { - $user = menu_get_object('user_uid_optional', $i); - if (!empty($user)) { - return $user->uid; - } - } - - if (!empty($this->options['user'])) { - foreach (range(1, 3) as $i) { - $node = menu_get_object('node', $i); - if (!empty($node)) { - return $node->uid; - } - } - } - - if (arg(0) == 'user' && is_numeric(arg(1))) { - return arg(1); - } - - if (!empty($this->options['user'])) { - if (arg(0) == 'node' && is_numeric(arg(1))) { - $node = node_load(arg(1)); - if ($node) { - return $node->uid; - } - } - } - - // If the current page is a view that takes uid as an argument, return the uid. - $view = views_get_page_view(); - - if ($view && isset($view->argument['uid'])) { - return $view->argument['uid']->argument; - } - } -} diff --git a/modules/user/views_plugin_argument_validate_user.inc b/modules/user/views_plugin_argument_validate_user.inc deleted file mode 100644 index 74eb23f06420c42af717167fc4e30fb9831335cf..0000000000000000000000000000000000000000 --- a/modules/user/views_plugin_argument_validate_user.inc +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -/** - * @file - * Definition of views_plugin_argument_validate_user. - */ - -use Drupal\views\Plugins\views\argument_validator\ArgumentValidatorPluginBase; - -/** - * Validate whether an argument is a valid user. - * - * This supports either numeric arguments (UID) or strings (username) and - * converts either one into the user's UID. This validator also sets the - * argument's title to the username. - */ -class views_plugin_argument_validate_user extends ArgumentValidatorPluginBase { - function option_definition() { - $options = parent::option_definition(); - $options['type'] = array('default' => 'uid'); - $options['restrict_roles'] = array('default' => FALSE, 'bool' => TRUE); - $options['roles'] = array('default' => array()); - - return $options; - } - - function options_form(&$form, &$form_state) { - $form['type'] = array( - '#type' => 'radios', - '#title' => t('Type of user filter value to allow'), - '#options' => array( - 'uid' => t('Only allow numeric UIDs'), - 'name' => t('Only allow string usernames'), - 'either' => t('Allow both numeric UIDs and string usernames'), - ), - '#default_value' => $this->options['type'], - ); - - $form['restrict_roles'] = array( - '#type' => 'checkbox', - '#title' => t('Restrict user based on role'), - '#default_value' => $this->options['restrict_roles'], - ); - - $form['roles'] = array( - '#type' => 'checkboxes', - '#title' => t('Restrict to the selected roles'), - '#options' => array_map('check_plain', user_roles(TRUE)), - '#default_value' => $this->options['roles'], - '#description' => t('If no roles are selected, users from any role will be allowed.'), - '#states' => array( - 'visible' => array( - ':input[name="options[validate][options][user][restrict_roles]"]' => array('checked' => TRUE), - ), - ), - ); - } - - function options_submit(&$form, &$form_state, &$options = array()) { - // filter trash out of the options so we don't store giant unnecessary arrays - $options['roles'] = array_filter($options['roles']); - } - - function convert_options(&$options) { - if (!isset($options['type']) && isset($this->argument->options['validate_user_argument_type'])) { - $options['type'] = $this->argument->options['validate_user_argument_type']; - $options['restrict_roles'] = $this->argument->options['validate_user_restrict_roles']; - $options['roles'] = $this->argument->options['validate_user_roles']; - } - } - - function validate_argument($argument) { - $type = $this->options['type']; - // is_numeric() can return false positives, so we ensure it's an integer. - // However, is_integer() will always fail, since $argument is a string. - if (is_numeric($argument) && $argument == (int)$argument) { - if ($type == 'uid' || $type == 'either') { - if ($argument == $GLOBALS['user']->uid) { - // If you assign an object to a variable in PHP, the variable - // automatically acts as a reference, not a copy, so we use - // clone to ensure that we don't actually mess with the - // real global $user object. - $account = clone $GLOBALS['user']; - } - $where = 'uid = :argument'; - } - } - else { - if ($type == 'name' || $type == 'either') { - $name = !empty($GLOBALS['user']->name) ? $GLOBALS['user']->name : variable_get('anonymous', t('Anonymous')); - if ($argument == $name) { - $account = clone $GLOBALS['user']; - } - $where = "name = :argument"; - } - } - - // If we don't have a WHERE clause, the argument is invalid. - if (empty($where)) { - return FALSE; - } - - if (!isset($account)) { - $query = "SELECT uid, name FROM {users} WHERE $where"; - $account = db_query($query, array(':argument' => $argument))->fetchObject(); - } - if (empty($account)) { - // User not found. - return FALSE; - } - - // See if we're filtering users based on roles. - if (!empty($this->options['restrict_roles']) && !empty($this->options['roles'])) { - $roles = $this->options['roles']; - $account->roles = array(); - $account->roles[] = $account->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID; - $result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->uid)); - foreach ($result as $role) { - $account->roles[] = $role->rid; - } - if (!(bool) array_intersect($account->roles, $roles)) { - return FALSE; - } - } - - $this->argument->argument = $account->uid; - $this->argument->validated_title = check_plain(user_format_name($account)); - return TRUE; - } - - function process_summary_arguments(&$args) { - // If the validation says the input is an username, we should reverse the - // argument so it works for example for generation summary urls. - $uids_arg_keys = array_flip($args); - if ($this->options['type'] == 'name') { - $users = user_load_multiple($args); - foreach ($users as $uid => $account) { - $args[$uids_arg_keys[$uid]] = $account->name; - } - } - } -} diff --git a/modules/user/views_plugin_row_user_view.inc b/modules/user/views_plugin_row_user_view.inc deleted file mode 100644 index 336d4d91daccc8784de7343518709b89a7c2d24c..0000000000000000000000000000000000000000 --- a/modules/user/views_plugin_row_user_view.inc +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/** - * @file - * Contains the user view row plugin. - */ - -use Drupal\views\Plugins\views\row\RowPluginBase; - -/** - * A row plugin which renders a user via user_view. - * - * @ingroup views_row_plugins - */ -class views_plugin_row_user_view extends RowPluginBase { - var $base_table = 'users'; - var $base_field = 'uid'; - - // Store the users to be used for pre_render. - var $users = array(); - - function option_definition() { - $options = parent::option_definition(); - $options['view_mode'] = array('default' => 'full'); - - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $options = $this->options_form_summary_options(); - $form['view_mode'] = array( - '#type' => 'select', - '#options' => $options, - '#title' => t('View mode'), - '#default_value' => $this->options['view_mode'], - ); - $form['help']['#markup'] = t("Display the user with standard user view. It might be necessary to add a user-profile.tpl.php in your themes template folder, because the default <a href=\"@user-profile-api-link\">user-profile</a>e template don't show the username per default.", array('@user-profile-api-link' => url('http://api.drupal.org/api/drupal/modules--user--user-profile.tpl.php/7'))); - } - - - /** - * Return the main options, which are shown in the summary title. - */ - function options_form_summary_options() { - $entity_info = entity_get_info('user'); - $options = array(); - if (!empty($entity_info['view modes'])) { - foreach ($entity_info['view modes'] as $mode => $settings) { - $options[$mode] = $settings['label']; - } - } - if (empty($options)) { - $options = array( - 'full' => t('User account') - ); - } - - return $options; - } - - function summary_title() { - $options = $this->options_form_summary_options(); - return check_plain($options[$this->options['view_mode']]); - } - - function pre_render($values) { - $uids = array(); - foreach ($values as $row) { - $uids[] = $row->{$this->field_alias}; - } - $this->users = user_load_multiple($uids); - } - - function render($row) { - $account = $this->users[$row->{$this->field_alias}]; - $account->view = $this->view; - $build = user_view($account, $this->options['view_mode']); - - return drupal_render($build); - } -} diff --git a/plugins/views_plugin_display_embed.inc b/plugins/views_plugin_display_embed.inc deleted file mode 100644 index 8b25cf9611171e5168ff88c8c944e6771ad66d57..0000000000000000000000000000000000000000 --- a/plugins/views_plugin_display_embed.inc +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * @file - * Contains the embed display plugin. - */ - -/** - * The plugin that handles an embed display. - * - * @ingroup views_display_plugins - */ -class views_plugin_display_embed extends views_plugin_display { - // This display plugin does nothing apart from exist. -}