You are here

function acquia_contenthub_form_entity_form_alter in Acquia Content Hub 8

Generic alter handler for the entity form. Not natively hooked by naming.

Implements hook_form_BASE_FORM_ID_alter().

3 calls to acquia_contenthub_form_entity_form_alter()
acquia_contenthub_form_block_content_form_alter in ./acquia_contenthub.module
Implements hook_form_BASE_FORM_ID_alter().
acquia_contenthub_form_node_form_alter in ./acquia_contenthub.module
Implements hook_form_BASE_FORM_ID_alter().
acquia_contenthub_form_taxonomy_term_form_alter in ./acquia_contenthub.module
Implements hook_form_BASE_FORM_ID_alter().

File

./acquia_contenthub.module, line 92
Contains acquia_contenthub.module.

Code

function acquia_contenthub_form_entity_form_alter(&$form, $form_state, $entity_type_id) {

  /* @var Drupal\Core\Entity\FieldableEntityInterface $entity */
  $entity = $form_state
    ->getFormObject()
    ->getEntity();
  $entity_form_service = \Drupal::service('acquia_contenthub.form.entity_form');
  $entity_form = $entity_form_service
    ->getForm($entity);
  if (!$entity_form) {
    return;
  }

  // Attach node form.
  $form['acquia_contenthub'] = $entity_form;

  // Attach submit handler.
  $submit_handler_name = 'acquia_contenthub_form_' . $entity_type_id . '_form_submit';
  $entity_form_service
    ->attachSubmitHandler($form['actions'], $submit_handler_name);
}