class ViewsViewsExecutionHooks

Hook implementations for views.

Hierarchy

Expanded class hierarchy of ViewsViewsExecutionHooks

File

core/modules/views/src/Hook/ViewsViewsExecutionHooks.php, line 12

Namespace

Drupal\views\Hook
View source
class ViewsViewsExecutionHooks {
    
    /**
     * Implements hook_views_query_substitutions().
     *
     * Makes the following substitutions:
     * - Current time.
     * - Drupal version.
     * - Special language codes; see
     *   \Drupal\views\Plugin\views\PluginBase::listLanguages().
     */
    public function viewsQuerySubstitutions(ViewExecutable $view) {
        $substitutions = [
            '***CURRENT_VERSION***' => \Drupal::VERSION,
            '***CURRENT_TIME***' => \Drupal::time()->getRequestTime(),
        ] + PluginBase::queryLanguageSubstitutions();
        return $substitutions;
    }
    
    /**
     * Implements hook_views_form_substitutions().
     */
    public function viewsFormSubstitutions() {
        $select_all = [
            '#type' => 'checkbox',
            '#default_value' => FALSE,
            '#attributes' => [
                'class' => [
                    'action-table-select-all',
                ],
            ],
        ];
        return [
            '<!--action-bulk-form-select-all-->' => \Drupal::service('renderer')->render($select_all),
        ];
    }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.