MenuLinkFormInterface.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Drupal\Core\Menu\Form;
  3. use Drupal\Core\Form\FormStateInterface;
  4. use Drupal\Core\Menu\MenuLinkInterface;
  5. use Drupal\Core\Plugin\PluginFormInterface;
  6. /**
  7. * Defines an interface for edit forms of menu links.
  8. *
  9. * All menu link plugins use the same interface for their configuration or
  10. * editing form, but the implementations may differ.
  11. *
  12. * @see \Drupal\Core\Menu\MenuLinkInterface::getFormClass()
  13. */
  14. interface MenuLinkFormInterface extends PluginFormInterface {
  15. /**
  16. * Injects the menu link plugin instance.
  17. *
  18. * @param \Drupal\Core\Menu\MenuLinkInterface $menu_link
  19. * A menu link plugin instance.
  20. */
  21. public function setMenuLinkInstance(MenuLinkInterface $menu_link);
  22. /**
  23. * Extracts a plugin definition from form values.
  24. *
  25. * @param array $form
  26. * An associative array containing the structure of the form.
  27. * @param \Drupal\Core\Form\FormStateInterface $form_state
  28. * The current state of the form.
  29. *
  30. * @return array
  31. * The new plugin definition values taken from the form values. The plugin
  32. * ID must be returned as part of the definition.
  33. */
  34. public function extractFormValues(array &$form, FormStateInterface $form_state);
  35. }