You are here

protected function InlineEntityFormBase::canBuildForm in Inline Entity Form 8

Checks whether we can build entity form at all.

  • Is IEF handler loaded?
  • Are we on a "real" entity form and not on default value widget?

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form state.

Return value

bool TRUE if we are able to proceed with form build and FALSE if not.

1 call to InlineEntityFormBase::canBuildForm()
InlineEntityFormBase::form in src/Plugin/Field/FieldWidget/InlineEntityFormBase.php
Creates a form element for a field.

File

src/Plugin/Field/FieldWidget/InlineEntityFormBase.php, line 355

Class

InlineEntityFormBase
Inline entity form widget base class.

Namespace

Drupal\inline_entity_form\Plugin\Field\FieldWidget

Code

protected function canBuildForm(FormStateInterface $form_state) {
  if ($this
    ->isDefaultValueWidget($form_state)) {
    return FALSE;
  }
  if (!$this->inlineFormHandler) {
    return FALSE;
  }
  return TRUE;
}