You could try the following:
- Define your own ViewsField plugin that extends the CommentBulkForm (that is where that message comes from)
<?php
namespace Drupal\your_module\Plugin\views\field;
use Drupal\views\Plugin\views\field\BulkForm;
/**
* Defines a custom comment operations bulk form element.
*
* @ViewsField("custom_comment_bulk_form")
*/
class CustomCommentBulkForm extends CommentBulkForm {
/**
* {@inheritdoc}
*/
protected function emptySelectedMessage() {
return $this->t('An attachment has to be selected to perform this action.');
}
}
- Expose your plugin to views:
function your_module_views_data() {
$data['comment']['custom_comment_bulk_form'] = [
'title' => t('Custom comment operations bulk form'),
'help' => t('Add a form element that lets you run operations on multiple comments, with custom messages.'),
'field' => [
'id' => 'custom_comment_bulk_form',
],
];
return $data;
}
- Finally, overwrite (or override) your (views.view.) Comments configuration so that your existing 'Comment: Comment operations bulk form' field is forced to use your ViewsField plugin. One way to overwrite would be via drush:
drush cset views.view.comment \
display.default.display_options.fields.comment_bulk_form.field \
custom_comment_bulk_form
That would eventually allow you to set your own custom message:
Good luck!