diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php index 7fecca1..a754828 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php @@ -41,4 +41,11 @@ public function views_form_submit(&$form, &$form_state) { } } + /** + * {@inheritdoc} + */ + protected function emptySelectedMessage() { + return t('No content selected.'); + } + } diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php index 24c9d81..08b85b8 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php +++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php @@ -73,7 +73,7 @@ public function preRender(&$values) { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions(). + * {@inheritdoc} */ protected function defineOptions() { $options = parent::defineOptions(); @@ -87,7 +87,7 @@ protected function defineOptions() { } /** - * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm(). + * {@inheritdoc} */ public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); @@ -110,7 +110,7 @@ public function buildOptionsForm(&$form, &$form_state) { } /** - * Overrides \Drupal\views\Plugin\views\HandlerBase::validateOptionsForm(). + * {@inheritdoc} */ public function validateOptionsForm(&$form, &$form_state) { parent::validateOptionsForm($form, $form_state); @@ -248,12 +248,22 @@ public function views_form_submit(&$form, &$form_state) { } /** + * Set a message text to be displayed when there are no items selected in the + * listing. + * + * @return string + */ + protected function emptySelectedMessage() { + return t('No items selected.'); + } + + /** * {@inheritdoc} */ public function views_form_validate(&$form, &$form_state) { $selected = array_filter($form_state['values'][$this->options['id']]); if (empty($selected)) { - form_set_error('', t('No items selected.')); + form_set_error('', $this->emptySelectedMessage()); } } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php index 5530204..1fe9f1f 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserBulkForm.php @@ -51,4 +51,11 @@ public function views_form(&$form, &$form_state) { } } + /** + * {@inheritdoc} + */ + protected function emptySelectedMessage() { + return t('No users selected.'); + } + } diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/BulkFormTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/BulkFormTest.php index dd5ab6b..d2d42fc 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/BulkFormTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/Views/BulkFormTest.php @@ -42,7 +42,7 @@ public function testBulkForm() { $this->drupalPost('test-user-bulk-form', $edit, t('Apply')); // @todo Validation errors are only shown on page refresh. $this->drupalGet('test-user-bulk-form'); - $this->assertText(t('No items selected.')); + $this->assertText(t('No users selected.')); // Assign a role to a user. $account = entity_load('user', $this->users[0]->id());