public static function AccessControlHierarchyBase::submitEntity in Workbench Access 8
Responds to the submission of an entity form.
If the entity contains section values that the user cannot change, they are passed in the 'workbench_access_disallowed' field on the form. Plugins should examine that value and make modifications to their target field as necessary.
A default implementation is provided which only supports nodes.
Parameters
array &$form: A form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form_state object.
Overrides AccessControlHierarchyInterface::submitEntity
File
- src/AccessControlHierarchyBase.php, line 246 
Class
- AccessControlHierarchyBase
- Defines a base hierarchy class that others may extend.
Namespace
Drupal\workbench_accessCode
public static function submitEntity(array &$form, FormStateInterface $form_state) {
  /** @var \Drupal\workbench_access\Entity\AccessSchemeInterface $access_scheme */
  foreach (\Drupal::entityTypeManager()
    ->getStorage('access_scheme')
    ->loadMultiple() as $access_scheme) {
    $scheme = $access_scheme
      ->getAccessScheme();
    $hidden_values = $form_state
      ->getValue('workbench_access_disallowed');
    if (!empty($hidden_values)) {
      $entity = $form_state
        ->getFormObject()
        ->getEntity();
      $scheme
        ->massageFormValues($entity, $form_state, $hidden_values);
    }
  }
}