protected function EntityExportFormBuilder::isEntityEditForm in Content Synchronizer 8
Same name and namespace in other branches
- 8.2 src/Service/EntityExportFormBuilder.php \Drupal\content_synchronizer\Service\EntityExportFormBuilder::isEntityEditForm()
- 3.x src/Service/EntityExportFormBuilder.php \Drupal\content_synchronizer\Service\EntityExportFormBuilder::isEntityEditForm()
Return true if the form needs to have an export field.
Parameters
array $form: The form build array.
\Drupal\Core\Form\FormStateInterface $formState: The formState array.
Return value
bool The result.
1 call to EntityExportFormBuilder::isEntityEditForm()
- EntityExportFormBuilder::addExportFields in src/
Service/ EntityExportFormBuilder.php - Add the export submform in the entity edition form, if the entity is exportable.
File
- src/
Service/ EntityExportFormBuilder.php, line 49
Class
- EntityExportFormBuilder
- The entity export form builder.
Namespace
Drupal\content_synchronizer\ServiceCode
protected function isEntityEditForm(array &$form, FormStateInterface $formState) {
/** @var \Drupal\Core\Entity\EntityForm $formObject */
$formObject = $formState
->getFormObject();
if ($formObject instanceof EntityForm) {
if (in_array($formObject
->getOperation(), [
'edit',
'default',
])) {
$entity = $formObject
->getEntity();
if (strpos(get_class($entity), 'content_synchronizer') === FALSE) {
if ($objectId = $entity
->id()) {
return isset($objectId);
}
}
}
}
return FALSE;
}