You are here

public static function EntityconnectFormUtils::fieldConfigEditFormAlter in Entity connect 8.2

Adds entityconnect settings to the entity reference field config.

Parameters

array $form: The form to add to.

\Drupal\Core\Form\FormStateInterface $form_state: The state of the form.

1 call to EntityconnectFormUtils::fieldConfigEditFormAlter()
entityconnect_form_field_config_edit_form_alter in ./entityconnect.module
Implements hook_form_FORM_ID_alter() for field_config_edit_form.

File

src/EntityconnectFormUtils.php, line 24

Class

EntityconnectFormUtils
Contains form alter, callbacks and utility methods for entityconnect.

Namespace

Drupal\entityconnect

Code

public static function fieldConfigEditFormAlter(array &$form, FormStateInterface $form_state) {
  $field = $form_state
    ->getFormObject()
    ->getEntity();
  $type = $field
    ->getType();
  if ($type == 'entity_reference') {
    $defaults = $field
      ->getThirdPartySettings('entityconnect');
    if (!$defaults) {
      $config = \Drupal::config('entityconnect.administration_config');
      $defaults = $config
        ->get();
    }
    AdministrationForm::attach($form['third_party_settings'], $defaults);
  }
}