public function MenuEntityCloneForm::formElement in Entity Clone 8
Get all specific form element.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity.
bool $parent: Is the parent form element.
Return value
array The form elements.
Overrides ConfigEntityCloneFormBase::formElement
File
- src/
EntityClone/ Config/ MenuEntityCloneForm.php, line 15
Class
- MenuEntityCloneForm
- Class MenuEntityCloneForm.
Namespace
Drupal\entity_clone\EntityClone\ConfigCode
public function formElement(EntityInterface $entity, $parent = TRUE) {
$form = parent::formElement($entity, $parent);
// Menu entities require special replace pattern.
$form['id']['#machine_name'] += [
'replace_pattern' => '[^a-z0-9-]+',
'replace' => '-',
];
return $form;
}