PluginFormFactoryInterface.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\Core\Plugin;
  3. /**
  4. * Provides an interface for retrieving form objects for plugins.
  5. *
  6. * This allows a plugin to define multiple forms, in addition to the plugin
  7. * itself providing a form. All forms, decoupled or self-contained, must
  8. * implement \Drupal\Core\Plugin\PluginFormInterface. Decoupled forms can
  9. * implement \Drupal\Component\Plugin\PluginAwareInterface in order to gain
  10. * access to the plugin.
  11. */
  12. interface PluginFormFactoryInterface {
  13. /**
  14. * Creates a new form instance.
  15. *
  16. * @param \Drupal\Core\Plugin\PluginWithFormsInterface $plugin
  17. * The plugin the form is for.
  18. * @param string $operation
  19. * The name of the operation to use, e.g., 'add' or 'edit'.
  20. * @param string $fallback_operation
  21. * (optional) The name of the fallback operation to use.
  22. *
  23. * @return \Drupal\Core\Plugin\PluginFormInterface
  24. * A plugin form instance.
  25. *
  26. * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
  27. */
  28. public function createInstance(PluginWithFormsInterface $plugin, $operation, $fallback_operation = NULL);
  29. }