FeaturesGenerationMethodInterface.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace Drupal\features;
  3. use Drupal\Core\Form\FormStateInterface;
  4. /**
  5. * Interface for package assignment classes.
  6. */
  7. interface FeaturesGenerationMethodInterface {
  8. /**
  9. * Injects the features manager.
  10. *
  11. * @param \Drupal\features\FeaturesManagerInterface $features_manager
  12. * The features manager to be used to retrieve the configuration
  13. * list and the assigned packages.
  14. */
  15. public function setFeaturesManager(FeaturesManagerInterface $features_manager);
  16. /**
  17. * Injects the features assigner.
  18. *
  19. * @param \Drupal\features\FeaturesAssignerInterface $assigner
  20. * The features assigner to be used to retrieve the bundle configuration.
  21. */
  22. public function setAssigner(FeaturesAssignerInterface $assigner);
  23. /**
  24. * Prepares packages for generation.
  25. *
  26. * @param array $packages
  27. * Array of package data.
  28. * @param \Drupal\features\FeaturesBundleInterface $bundle
  29. * The optional bundle used for the generation. Used to generate profiles.
  30. *
  31. * @return array
  32. * An array of packages data.
  33. */
  34. public function prepare(array &$packages = array(), FeaturesBundleInterface $bundle = NULL);
  35. /**
  36. * Performs package generation.
  37. *
  38. * @param array $packages
  39. * Array of package data.
  40. * @param \Drupal\features\FeaturesBundleInterface $bundle
  41. * The optional bundle used for the generation. Used to generate profiles.
  42. *
  43. * @return array
  44. * Array of results for profile and/or packages, each result including the
  45. * following keys:
  46. * - 'success': boolean TRUE or FALSE for successful writing.
  47. * - 'display': boolean TRUE if the message should be displayed to the
  48. * user, otherwise FALSE.
  49. * - 'message': a message about the result of the operation.
  50. * - 'variables': an array of substitutions to be used in the message.
  51. */
  52. public function generate(array $packages = array(), FeaturesBundleInterface $bundle = NULL);
  53. /**
  54. * Responds to the submission of
  55. * \Drupal\features_ui\Form\FeaturesExportForm.
  56. */
  57. public function exportFormSubmit(array &$form, FormStateInterface $form_state);
  58. }