You are here

function flexiform_element_info_alter in Flexiform 8

Implements hook_element_info_alter().

File

./flexiform.module, line 34
Allow multiple entities to be used in an entity form display.

Code

function flexiform_element_info_alter(array &$types) {
  foreach ($types as &$type) {
    $method = 'processAjaxForm';
    $has_method = FALSE;
    if (!empty($type['#process'])) {
      foreach ($type['#process'] as $process) {
        if ($process[1] == $method) {
          $has_method = TRUE;
          break;
        }
      }
      if ($has_method) {
        $type['#process'][] = 'flexiform_ajax_form_process';
      }
    }
  }

  // Handle inline_entity_form stuff.
  if (isset($types['inline_entity_form'])) {
    $types['inline_entity_form']['#ief_element_submit'] = [
      'flexiform_ief_submit_entity_form',
    ];
  }
}