DevelGenerateBaseInterface.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Drupal\devel_generate;
  3. use Drupal\Component\Plugin\PluginInspectionInterface;
  4. use Drupal\Core\Form\FormStateInterface;
  5. /**
  6. * Base interface definition for "DevelGenerate" plugins.
  7. *
  8. * This interface details base wrapping methods that most DevelGenerate implementations
  9. * will want to directly inherit from Drupal\devel_generate\DevelGenerateBase.
  10. *
  11. * DevelGenerate impementationa plugins should developing settingsForm() and generateElements()
  12. * to achieve its own behaviour.
  13. *
  14. */
  15. interface DevelGenerateBaseInterface extends PluginInspectionInterface {
  16. /**
  17. * Returns the array of settings, including defaults for missing settings.
  18. *
  19. * @return array
  20. * The array of settings.
  21. */
  22. function getSetting($key);
  23. /**
  24. * Returns the default settings for the plugin.
  25. *
  26. * @return array
  27. * The array of default setting values, keyed by setting names.
  28. */
  29. function getDefaultSettings();
  30. /**
  31. * Returns the current settings for the plugin.
  32. *
  33. * @return array
  34. * The array of current setting values, keyed by setting names.
  35. */
  36. function getSettings();
  37. /**
  38. * Returns the form for the plugin.
  39. *
  40. * @return array
  41. * The array of default setting values, keyed by setting names.
  42. */
  43. function settingsForm(array $form, FormStateInterface $form_state);
  44. /**
  45. * Form validation handler.
  46. *
  47. * @param array $form
  48. * An associative array containing the structure of the form.
  49. * @param \Drupal\Core\Form\FormStateInterface $form_state
  50. * The current state of the form.
  51. */
  52. function settingsFormValidate(array $form, FormStateInterface $form_state);
  53. /**
  54. * Execute the instructions in common for all DevelGenerate plugin
  55. *
  56. * @param array $values
  57. * The input values from the settings form.
  58. */
  59. function generate(array $values);
  60. /**
  61. * Responsible for validating Drush params.
  62. *
  63. * @Return an array of values ready to be used for generateElements()
  64. */
  65. function validateDrushParams($args);
  66. }