You are here

public property ViewExecutable::$element in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::element

A render array container to store render related information.

For example you can alter the array and attach some asset library or JS settings via the #attached key. This is the required way to add custom CSS or JS.

Type: array

See also

\Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()

File

core/modules/views/src/ViewExecutable.php, line 399

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public $element = [
  '#attached' => [
    'library' => [
      'views/views.module',
    ],
    'drupalSettings' => [],
  ],
  '#cache' => [],
];