FeaturesBundleInterface.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. namespace Drupal\features;
  3. /**
  4. * Provides an interface for the FeaturesBundle object.
  5. */
  6. interface FeaturesBundleInterface {
  7. const DEFAULT_BUNDLE = 'default';
  8. /**
  9. * Determines whether the current bundle is the default one.
  10. *
  11. * @return bool
  12. * Returns TRUE if this is the default bundle.
  13. */
  14. public function isDefault();
  15. /**
  16. * Returns the machine name of a bundle.
  17. *
  18. * @return string
  19. * The machine name of a bundle.
  20. *
  21. * @see \Drupal\features\FeaturesBundleInterface::setMachineName()
  22. */
  23. public function getMachineName();
  24. /**
  25. * Sets the machine name of a bundle.
  26. *
  27. * @param string $machine_name
  28. * The machine name of a bundle.
  29. *
  30. * @see \Drupal\features\FeaturesBundleInterface::getMachineName()
  31. */
  32. public function setMachineName($machine_name);
  33. /**
  34. * Gets the human readable name of a bundle.
  35. *
  36. * @return string
  37. * The human readable name of a bundle.
  38. *
  39. * @see \Drupal\features\FeaturesBundleInterface::setName()
  40. */
  41. public function getName();
  42. /**
  43. * Sets the human readable name of a bundle.
  44. *
  45. * @param string $name
  46. * The human readable name of a bundle.
  47. *
  48. * @see \Drupal\features\FeaturesBundleInterface::getName()
  49. */
  50. public function setName($name);
  51. /**
  52. * Returns a full machine name prefixed with the bundle name.
  53. *
  54. * @param string $short_name
  55. * The short machine_name of a bundle.
  56. *
  57. * @return string
  58. * The full machine_name of a bundle.
  59. */
  60. public function getFullName($short_name);
  61. /**
  62. * Returns a short machine name not prefixed with the bundle name.
  63. *
  64. * @param string $machine_name
  65. * The full machine_name of a bundle.
  66. *
  67. * @return string
  68. * The short machine_name of a bundle.
  69. */
  70. public function getShortName($machine_name);
  71. /**
  72. * Determines if the $machine_name is prefixed by the bundle machine name.
  73. *
  74. * @param string $machine_name
  75. * The machine name of a package.
  76. *
  77. * @return bool
  78. * TRUE if the machine name is prefixed by the bundle machine name.
  79. */
  80. public function inBundle($machine_name);
  81. /**
  82. * Determines if the package with $machine_name is the bundle profile.
  83. *
  84. * @param string $machine_name
  85. * The machine name of a package.
  86. *
  87. * @return bool
  88. * TRUE if the package with $machine_name is the bundle profile.
  89. */
  90. public function isProfilePackage($machine_name);
  91. /**
  92. * Gets the description of a bundle.
  93. *
  94. * @return string
  95. * The description of a bundle.
  96. *
  97. * @see \Drupal\features\FeaturesBundleInterface::setDescription()
  98. */
  99. public function getDescription();
  100. /**
  101. * Sets the description of a bundle.
  102. *
  103. * @param string $description
  104. * The description of a bundle.
  105. *
  106. * @see \Drupal\features\FeaturesBundleInterface::getDescription()
  107. */
  108. public function setDescription($description);
  109. /**
  110. * Gets option for using a profile with this bundle.
  111. *
  112. * @return bool
  113. * TRUE if a profile is used with this profile.
  114. */
  115. public function isProfile();
  116. /**
  117. * Sets option for using a profile with this bundle.
  118. *
  119. * @param bool $value
  120. * TRUE if a profile is used with this bundle.
  121. */
  122. public function setIsProfile($value);
  123. /**
  124. * Returns the machine name of the profile.
  125. *
  126. * If the bundle doesn't use a profile, return the current site profile.
  127. *
  128. * @return string
  129. * THe machie name of a profile.
  130. *
  131. * @see \Drupal\features\FeaturesBundleInterface::setProfileName()
  132. */
  133. public function getProfileName();
  134. /**
  135. * Sets the name of the profile associated with this bundle.
  136. *
  137. * @param string $machine_name
  138. * The machine name of a profile.
  139. *
  140. * @see \Drupal\features\FeaturesBundleInterface::getProfileName()
  141. */
  142. public function setProfileName($machine_name);
  143. /**
  144. * Gets the list of enabled assignment methods.
  145. *
  146. * @return array
  147. * An array of method IDs keyed by assignment method IDs.
  148. *
  149. * @see \Drupal\features\FeaturesBundleInterface::setEnabledAssignments()
  150. */
  151. public function getEnabledAssignments();
  152. /**
  153. * Sets the list of enabled assignment methods.
  154. *
  155. * @param array $assignments
  156. * An array of values keyed by assignment method IDs. Non-empty value is
  157. * enabled.
  158. *
  159. * @see \Drupal\features\FeaturesBundleInterface::getEnabledAssignments()
  160. */
  161. public function setEnabledAssignments(array $assignments);
  162. /**
  163. * Gets the weights of the assignment methods.
  164. *
  165. * @return array
  166. * An array keyed by assignment method_id with a numeric weight.
  167. *
  168. * @see \Drupal\features\FeaturesBundleInterface::setAssignmentWeights()
  169. */
  170. public function getAssignmentWeights();
  171. /**
  172. * Sets the weights of the assignment methods.
  173. *
  174. * @param array $assignments
  175. * An array keyed by assignment method_id with a numeric weight value.
  176. *
  177. * @see \Drupal\features\FeaturesBundleInterface::getAssignmentWeights()
  178. */
  179. public function setAssignmentWeights(array $assignments);
  180. /**
  181. * Gets settings specific to an assignment method.
  182. *
  183. * @param string $method_id
  184. * The ID of an assignment method. If NULL, return all assignment settings
  185. * keyed by method_id.
  186. *
  187. * @return array
  188. * An array of settings. Format specific to assignment method.
  189. *
  190. * @see \Drupal\features\FeaturesBundleInterface::setAssignmentSettings()
  191. */
  192. public function getAssignmentSettings($method_id = NULL);
  193. /**
  194. * Sets settings specific to an assignment method.
  195. *
  196. * @param string $method_id
  197. * The ID of an assignment method. If NULL, all $settings are given keyed
  198. * by method_ID.
  199. * @param array $settings
  200. * An array of setting values.
  201. *
  202. * @see \Drupal\features\FeaturesBundleInterface::getAssignmentSettings()
  203. */
  204. public function setAssignmentSettings($method_id, array $settings);
  205. /**
  206. * Saves the bundle to the active config.
  207. */
  208. public function save();
  209. /**
  210. * Removes the bundle from the active config.
  211. */
  212. public function remove();
  213. }