public static function FormEntityContext::createFromFlexiformFormEntity in Flexiform 8
Create from a form entity plugin.
Parameters
\Drupal\flexiform\FormEntity\FlexiformFormEntityInterface $form_entity: The form entity plugin.
\Drupal\Core\Entity\FieldableEntityInterface $entity: The form entity to create from.
Return value
static The generated context.
1 call to FormEntityContext::createFromFlexiformFormEntity()
- FlexiformFormEntityManager::initFormEntities in src/
FormEntity/ FlexiformFormEntityManager.php - Initialize form entities.
File
- src/
FormEntity/ FormEntityContext.php, line 89
Class
- FormEntityContext
- Class for form entity contexts.
Namespace
Drupal\flexiform\FormEntityCode
public static function createFromFlexiformFormEntity(FlexiformFormEntityInterface $form_entity, FieldableEntityInterface $entity = NULL) {
$context_definition = new ContextDefinition('entity:' . $form_entity
->getEntityType(), $form_entity
->getLabel());
$context_definition
->addConstraint('Bundle', [
$form_entity
->getBundle(),
]);
$context = new static($context_definition, $entity);
$context
->setFormEntity($form_entity);
return $context;
}