You are here

class UserBulkForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm
  2. 9 core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm

Defines a user operations bulk form element.

Plugin annotation

@ViewsField("user_bulk_form");

Hierarchy

Expanded class hierarchy of UserBulkForm

File

core/modules/user/src/Plugin/views/field/UserBulkForm.php, line 14

Namespace

Drupal\user\Plugin\views\field
View source
class UserBulkForm extends BulkForm {

  /**
   * {@inheritdoc}
   *
   * Provide a more useful title to improve the accessibility.
   */
  public function viewsForm(&$form, FormStateInterface $form_state) {
    parent::viewsForm($form, $form_state);
    if (!empty($this->view->result)) {
      foreach ($this->view->result as $row_index => $result) {
        $account = $result->_entity;
        if ($account instanceof UserInterface) {
          $form[$this->options['id']][$row_index]['#title'] = $this
            ->t('Update the user %name', [
            '%name' => $account
              ->label(),
          ]);
        }
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function emptySelectedMessage() {
    return $this
      ->t('No users selected.');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BulkForm::$actions protected property An array of actions that can be executed.
BulkForm::$actionStorage protected property The action storage.
BulkForm::$entityRepository protected property The entity repository service.
BulkForm::$entityTypeManager protected property The entity type manager.
BulkForm::$languageManager protected property The language manager.
BulkForm::$messenger protected property The messenger.
BulkForm::buildOptionsForm public function
BulkForm::calculateEntityBulkFormKey protected function Calculates a bulk form key.
BulkForm::clickSortable public function
BulkForm::create public static function
BulkForm::defineOptions protected function
BulkForm::getBulkOptions protected function Returns the available operations for this form.
BulkForm::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
BulkForm::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
BulkForm::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
BulkForm::getEntityRepository protected function
BulkForm::getEntityTypeId public function Returns the entity type identifier. Overrides EntityTranslationRenderTrait::getEntityTypeId
BulkForm::getEntityTypeManager protected function
BulkForm::getLanguageManager protected function Returns the language manager. Overrides EntityTranslationRenderTrait::getLanguageManager
BulkForm::getValue public function Overrides UncacheableFieldHandlerTrait::getValue
BulkForm::getView protected function Returns the top object of a view. Overrides EntityTranslationRenderTrait::getView
BulkForm::init public function
BulkForm::loadEntityFromBulkFormKey protected function Loads an entity based on a bulk form key.
BulkForm::preRender public function
BulkForm::query public function
BulkForm::validateOptionsForm public function
BulkForm::viewsFormSubmit public function Submit handler for the bulk form.
BulkForm::viewsFormValidate public function
BulkForm::__construct public function Constructs a new BulkForm object.
EntityTranslationRenderTrait::$entityTranslationRenderer protected property The renderer to be used to render the entity row.
EntityTranslationRenderTrait::getEntityTranslation public function Returns the entity translation matching the configured row language.
EntityTranslationRenderTrait::getEntityTranslationRenderer protected function Returns the current renderer.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
UncacheableFieldHandlerTrait::doRender protected function Actually renders the field markup.
UncacheableFieldHandlerTrait::getFieldTokenPlaceholder abstract protected function
UncacheableFieldHandlerTrait::postRender public function
UncacheableFieldHandlerTrait::render public function
UserBulkForm::emptySelectedMessage protected function Returns the message to be displayed when there are no selected items. Overrides BulkForm::emptySelectedMessage
UserBulkForm::viewsForm public function Provide a more useful title to improve the accessibility. Overrides BulkForm::viewsForm