function SaveAction::access

Same name in other branches
  1. 9 core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php \Drupal\Core\Action\Plugin\Action\SaveAction::access()
  2. 8.9.x core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php \Drupal\Core\Action\Plugin\Action\SaveAction::access()
  3. 11.x core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php \Drupal\Core\Action\Plugin\Action\SaveAction::access()

Overrides ActionInterface::access

File

core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php, line 72

Class

SaveAction
Provides an action that can save any entity.

Namespace

Drupal\Core\Action\Plugin\Action

Code

public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
    // It's not necessary to check the changed field access here, because
    // Drupal\Core\Field\ChangedFieldItemList would anyway return 'not allowed'.
    // Also changing the changed field value is only a workaround to trigger an
    // entity resave. Without a field change, this would not be possible.
    
    /** @var \Drupal\Core\Entity\EntityInterface $object */
    return $object->access('update', $account, $return_as_object);
}

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