diff --git a/core/modules/views/config/schema/views.row.schema.yml b/core/modules/views/config/schema/views.row.schema.yml index f91ff0989e..bba8b36780 100644 --- a/core/modules/views/config/schema/views.row.schema.yml +++ b/core/modules/views/config/schema/views.row.schema.yml @@ -14,9 +14,9 @@ views.row.fields: default_field_elements: type: boolean label: 'Provide default field wrapper elements' - add_active_class: + set_active_class: type: boolean - label: 'Add "active" class on links' + label: 'Set the active class on links' inline: type: sequence label: 'Inline' diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 81b6c606d2..4c5b758de2 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -1167,7 +1167,7 @@ public function advancedRender(ResultRow $values) { foreach ($raw_items as $count => $item) { // Setting the active class on a link is now an opt-in feature, so // we need to check if the feature is activated for this view. - if (!empty($this->view->rowPlugin->options['add_active_class']) && is_array($item['rendered']) && !empty($item['rendered']['#url'])) { + if (!empty($this->view->rowPlugin->options['set_active_class']) && is_array($item['rendered']) && !empty($item['rendered']['#url'])) { $item['rendered']['#url']->setOptions(['set_active_class' => TRUE]); } $value = $this->render_item($count, $item); @@ -1399,7 +1399,7 @@ protected function renderAsLink($alter, $text, $tokens) { 'fragment' => NULL, 'language' => NULL, 'query' => [], - 'set_active_class' => !empty($this->view->rowPlugin->options['add_active_class']), + 'set_active_class' => !empty($this->view->rowPlugin->options['set_active_class']), ]; $alter += [ diff --git a/core/modules/views/src/Plugin/views/row/Fields.php b/core/modules/views/src/Plugin/views/row/Fields.php index 3c594940d2..543d0de035 100644 --- a/core/modules/views/src/Plugin/views/row/Fields.php +++ b/core/modules/views/src/Plugin/views/row/Fields.php @@ -36,7 +36,7 @@ protected function defineOptions() { $options['separator'] = ['default' => '']; $options['hide_empty'] = ['default' => FALSE]; $options['default_field_elements'] = ['default' => TRUE]; - $options['add_active_class'] = ['default' => FALSE]; + $options['set_active_class'] = ['default' => FALSE]; return $options; } @@ -58,11 +58,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#description' => $this->t('If not checked, fields that are not configured to customize their HTML elements will get no wrappers at all for their field, label and field + label wrappers. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'), ]; - $form['add_active_class'] = [ + $form['set_active_class'] = [ '#type' => 'checkbox', - '#title' => $this->t('Add "active" class on links'), - '#default_value' => $this->options['add_active_class'], - '#description' => $this->t('If checked, if the fields link to the current page, an "is-active" class will be added on the link. WARNING: This feature limits the caching possibilities of this view and should only be enabled when needed.'), + '#title' => $this->t('Set the active class on links'), + '#default_value' => $this->options['set_active_class'], + '#description' => $this->t('If checked, if the fields link to the current page, an "is-active" class will be added on active links. WARNING: This feature limits the caching possibilities of this view and should only be enabled when needed.'), ]; $form['inline'] = [