You are here

public function EditableFieldsHelper::getForm in Editable Fields 8

Same name and namespace in other branches
  1. 1.0.x src/services/EditableFieldsHelper.php \Drupal\editablefields\services\EditableFieldsHelper::getForm()

Prepares a render array of the editable field form.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity object.

string $field_name: Field name.

string $form_mode: Form mode.

Return value

array Form render array.

Overrides EditableFieldsHelperInterface::getForm

File

src/services/EditableFieldsHelper.php, line 102

Class

EditableFieldsHelper
Class EditableFieldsHelper.

Namespace

Drupal\editablefields\services

Code

public function getForm(EntityInterface $entity, string $field_name, string $form_mode) {

  /** @var \Drupal\editablefields\Form\EditableFieldsForm $form_object */
  $form_object = $this->classResolver
    ->getInstanceFromDefinition(self::FORM_CLASS);
  $form_object
    ->setDefaults($entity, $field_name, $form_mode);
  return $this->formBuilder
    ->getForm($form_object);
}