You are here

function domain_access_form_alter in Domain Access 8

Implements hook_form_alter().

Find forms that contain the domain access field and allow those to handle default values properly. Note that here we just care if the form saves an entity. We then pass that entity to a helper function.

See also

domain_access_default_form_values()

File

domain_access/domain_access.module, line 733
Domain-based access control for content.

Code

function domain_access_form_alter(&$form, &$form_state, $form_id) {
  if ($object = $form_state
    ->getFormObject() && !empty($object) && is_callable([
    $object,
    'getEntity',
  ]) && ($entity = $object
    ->getEntity())) {
    domain_access_default_form_values($form, $form_state, $entity);
  }
}