You are here

protected function EntityExtraFieldForm::createFieldTypeInstance in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Form/EntityExtraFieldForm.php \Drupal\entity_extra_field\Form\EntityExtraFieldForm::createFieldTypeInstance()

Create extra field type plugin instance.

Parameters

$plugin_id: The field type plugin identifier.

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

Return value

\Drupal\entity_extra_field\ExtraFieldTypePluginInterface|FALSE Return the extra field type plugin instance; otherwise FALSE if it doesn't exist.

Throws

\Drupal\Component\Plugin\Exception\PluginException

3 calls to EntityExtraFieldForm::createFieldTypeInstance()
EntityExtraFieldForm::form in src/Form/EntityExtraFieldForm.php
Gets the actual form array to be built.
EntityExtraFieldForm::submitForm in src/Form/EntityExtraFieldForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
EntityExtraFieldForm::validateForm in src/Form/EntityExtraFieldForm.php
Form validation handler.

File

src/Form/EntityExtraFieldForm.php, line 318

Class

EntityExtraFieldForm
Define entity extra field form.

Namespace

Drupal\entity_extra_field\Form

Code

protected function createFieldTypeInstance($plugin_id, FormStateInterface $form_state) {
  $field_type_manager = $this->extraFieldTypeManager;
  if (!$field_type_manager
    ->hasDefinition($plugin_id)) {
    return FALSE;
  }
  return $field_type_manager
    ->createInstance($plugin_id, $this
    ->getEntityFormStateValue('field_type_config', $form_state, []));
}