You are here

public function FormModeManager::setLinkTemplatePerFormModes in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/FormModeManager.php \Drupal\form_mode_manager\FormModeManager::setLinkTemplatePerFormModes()

Set new LinkTemplate handler on entity definition basis.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_definition: The entity type to alter.

string $form_mode_name: The form mode human name used by current entity definition.

Overrides FormModeManagerInterface::setLinkTemplatePerFormModes

1 call to FormModeManager::setLinkTemplatePerFormModes()
FormModeManager::setEntityHandlersPerFormModes in src/FormModeManager.php
Set all entity handlers needed by form mode manager on entity type basis.

File

src/FormModeManager.php, line 324

Class

FormModeManager
FormDisplayManager service.

Namespace

Drupal\form_mode_manager

Code

public function setLinkTemplatePerFormModes(EntityTypeInterface $entity_definition, $form_mode_name) {
  if ($entity_definition
    ->getFormClass($form_mode_name) && $entity_definition
    ->hasLinkTemplate('edit-form')) {
    $entity_definition
      ->setLinkTemplate("edit-form.{$form_mode_name}", $entity_definition
      ->getLinkTemplate('edit-form') . '/' . $form_mode_name);
  }
}