class Vid in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/src/Plugin/views/argument/Vid.php \Drupal\node\Plugin\views\argument\Vid
- 9 core/modules/node/src/Plugin/views/argument/Vid.php \Drupal\node\Plugin\views\argument\Vid
Argument handler to accept a node revision id.
Plugin annotation
@ViewsArgument("node_vid");Hierarchy
- class \Drupal\views\Plugin\views\argument\NumericArgument extends \Drupal\views\Plugin\views\argument\ArgumentPluginBase- class \Drupal\node\Plugin\views\argument\Vid
 
Expanded class hierarchy of Vid
File
- core/modules/ node/ src/ Plugin/ views/ argument/ Vid.php, line 14 
Namespace
Drupal\node\Plugin\views\argumentView source
class Vid extends NumericArgument {
  /**
   * The node storage.
   *
   * @var \Drupal\node\NodeStorageInterface
   */
  protected $nodeStorage;
  /**
   * Constructs a \Drupal\node\Plugin\views\argument\Vid object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\node\NodeStorageInterface $node_storage
   *   The node storage.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, NodeStorageInterface $node_storage) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->nodeStorage = $node_storage;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_type.manager')
      ->getStorage('node'));
  }
  /**
   * Override the behavior of title(). Get the title of the revision.
   */
  public function titleQuery() {
    $titles = [];
    $results = $this->nodeStorage
      ->getAggregateQuery()
      ->accessCheck(FALSE)
      ->allRevisions()
      ->groupBy('title')
      ->condition('vid', $this->value, 'IN')
      ->execute();
    foreach ($results as $result) {
      $titles[] = $result['title'];
    }
    return $titles;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| NumericArgument:: | public | property | The actual value which is used for querying. | |
| NumericArgument:: | public | function | 1 | |
| NumericArgument:: | protected | function | 1 | |
| NumericArgument:: | public | function | ||
| NumericArgument:: | public | function | ||
| NumericArgument:: | public | function | 1 | |
| NumericArgument:: | public | function | 2 | |
| Vid:: | protected | property | The node storage. | |
| Vid:: | public static | function | ||
| Vid:: | public | function | Override the behavior of title(). Get the title of the revision. Overrides NumericArgument:: | |
| Vid:: | public | function | Constructs a \Drupal\node\Plugin\views\argument\Vid object. | 
