Same name in other branches
  1. 8.x-1.x src/EntityClone/Config/MenuEntityCloneForm.php \Drupal\entity_clone\EntityClone\Config\MenuEntityCloneForm::formElement()

Overrides ConfigEntityCloneFormBase::formElement

File

src/EntityClone/Config/MenuEntityCloneForm.php, line 15

Class

MenuEntityCloneForm
Class Menu Entity Clone Form.

Namespace

Drupal\entity_clone\EntityClone\Config

Code

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;
}