You are here

debutf.txt in Debut 7

Same filename and directory in other branches
  1. 6 debutf.txt
Debut Feature Specification (debutf 1.0-draft)
----------------------------------------------
Extending the kitf feature specification, this document provides a set of
requirements for Drupal features to provide suitable baseline functionality
suitable to various distributions and individual site installs and at the
same time integrate effectively into a cohesive feature set. Debut features
should together provide an integrated set of functionality that covers the
basic needs of most Drupal websites and distributions.

This document is based on the Drupal 7.x versions of Drupal core, contributed
modules and themes.


1. Introduction
---------------
The kitf feature specification provides important guidelines and requirements
to ensure interoperability among Drupal features.

Building on kitf, Debut features are based on the following precepts:

* Debut features should provide the basic functionality that most sites or
distributions will need.
* Any advanced or specialized functionality should be provided in separate
features that require more basic features.
* The ease of discovery and use of website feature for both admins and end
users should be an overriding goal.
* Every main task should have only one primary admin interface.
* Common protocols and solutions should be used to ensure consistency and ease
of use.

### Uniqueness and compatibility

Wherever possible, each Debut feature should cover a unique area of
functionality. For example, there should be only a single Debut feature
that provides general blog functionality. Exceptions can be made where the
underlying framework used is radically different and there is no common
base to build on.

### Available on the Drupal infrastructure

To ensure visibility, all Debut features should be hosted on the Drupal
infrastructure.

### Declaring compliance

Features compliant with this specification may declare themselves as such
in their module `.info` file using the `debutf` key and the version of this
document to which they comply. Example:

    debutf = "1.0-draft"

### Features framework

A feature should meet its needs through Features-aware solutions wherever
possible. Where multiple options exist, a primary selection criterion should be
how fully they embrace the Features framework.

- Context: Where context or contextual layout is required, the Context module
should be used.
- Boxes: Where custom blocks are required, the Boxes module must be used.
- Strongarm: Where variables are set, the Strongarm module should be used.
- Spaces: Where individual items (user spaces, pieces of content) require
contextual customization, the Spaces module should be used.

One of the most challenging tasks for novice site admins is controlling layout
of individual sections or pages. The Panels module is a highly advanced and
powerful solution for this purpose, but using Panels in combination with
Context is demanding and error-prone. If e.g. a node type is overridden with
a panel page, this panels page must be created by a single feature--barring
custom coding, there is no easy way for other features to selectively add
panes such that the overall panels page is constructed from the contributions
of whatever other features are enabled. For this reason, Context rather than
Panels seems the best overall choice for building displays in Debut.

### Standard solutions

To help produce uniformity among the various Debut features, standard solutions
are adopted across Debut. For example, for mapping, there are several Drupal
modules available, e.g., Gmap, OpenLayers. To ensure consistency, one should
be designated as the Debut standard.

In selecting between alternatives, the Drupal principles
(http://drupal.org/principles) are to be used as well as the following
additional criteria:

* Community open source: the candidate solution is a community-driven open
source solution.
* Non-proprietary: The candidate solution is not limited to, branded by, or
controlled by a single company.
* Data security: The candidate solution does not require posting data to an
external source unless doing so is the explicit purpose.
* Works out of the box without requiring manual configuration, e.g., entry of
an API key.

Before introducing a new Debut feature that introduces a dependency that could
be considered as a new standard solution, an issue must be posted on the Debut
project proposing the new standard solution with justification.

Adopted standard solutions:

- Captcha: where forms are protected from automated submission, the Captcha
module should be used.
- OpenLayers: where client side mapping is required, the OpenLayers Drupal
module should be used.
- Pathauto: where appropriate, paths variables should be set so that, if
Pathauto is present, content types defined by a feature will get appropriate
paths.
- Rules should be used and not the core Trigger module for any configurable
actions.

### Opportunity for peer review

There should be an opportunity for review prior to a new Debut feature being
posted. Such review will help ensure that new features indeed meet the Debut
spec, e.g.,

* identify any potential components that could/should be pulled into more
specific Debut features,
* identify properties that are too site-specific to warrant inclusion in Debut,
* if the feature introduces a new solution to standardize (e.g., an external
library or a way to structure particular data), ensure a consensus prior
to adoption.

Therefore each proposed Debut feature should be posted first as an issue on the
Debut project, with a link to the sandbox version of the proposed feature and
two weeks allowed for peer review prior to the new feature being promoted from
a sandbox project to a full project on drupal.org.

### Soft vs. hard configuration

A distinction should be made between "soft" and "hard" configuration.

Soft configuration is likely to be changed on a given site and doesn't require
or lend itself to updating in future code releases. Examples might include:

- A variable that controls which content types receive social media links. This
variable may be customized continuously as new content types are added to
the site.

Hard configuration is relatively unlikely to be customized on a given
site and/or lends itself to updating in a future feature release. Hard
configuration tends to be the core structure of a site. Examples might include:

- Content types and their fields.
- Views.

Hard configuration is properly handled by export into Features components.
However, soft configuration should live in the site database rather than code.
In general, soft configuration should be handled in hook_install() using
available API methods.


2. Namespaces
-------------

### 2.1 Code namespace

A Debut feature must include the debut namespace.

- Example: `debut_blog`.


### 2.2 Project namespace

A Debut project must include the debut namespace.

- Example: `debut_blog`.


3. User roles and permissions
-----------------------------

### 3.1 Required user roles

The `administrator` role defined in kitf should be used for site administration
tasks, such as installing and configuring modules, content types, and blocks.
The administrator role is defined by the Debut feature and so should not be
defined by any other Debut feature.

In addition to the three roles defined in kitf, features should use the
following two roles as appropriate.

- `contributor` is a Drupal user who contributes content, e.g., a staff member
at an organization or company.
- `editor` is a Drupal user responsible for editing and administrating content,
taxonomies, and comments.

These roles are provided by the Debut feature and so will be present if Debut
is installed. However, to avoid unwanted roles, Debut features should avoid
requiring the Debut feature if feasible.

A Debut feature may provide additional roles, but such roles should have a
scope no greater than the scope of the feature. For example, a blog feature
might provide a `blogger` role. However, a technology blog feature should not
provide a `blogger` role, since that role would be relevant to a more general
feature.

### 3.2 Permissions

Because Features will remove an existing permission from any role not
specified in an exported user permission, all permissions should be
explicitly assigned to the `administrator` role.

The editor role should not be expected to have `administer nodes` permissions.

For each content type introduced, roles should be assigned as follows:

- `contributor`: `create [type] content`, `delete own [type] content`, `edit
own [type] content`
- `editor`: `create [type] content`, `delete all [type] content`, `edit all
[type] content`

where [type] is the machine name of the content type being introduced by the
feature.


4. Variables
------------
A feature should include a settings form for any variables important to it.
Doing so will facilitate Spaces integration.


5. Paths and breadcrumbs
-----------------------

### 5.1 Primary path and nesting

Where a feature provides content or nested pages, these should wherever
feasible be available at paths nested below the feature's primary path.

Without creating a dependency on Pathauto, a feature that defines a content
type should register a pathauto pattern variable that nests content of that
type below the feature's primary page.

Example: a blog feature would use Strongarm to set pathauto_node_audio_pattern
to 'blog/[title-raw]'.

### 5.2 Menu location and breadcrumbs

Menu location and breadcrumbs for pages created by the feature should match the
nesting used for paths.

Context should be used to set breadcrumbs. For example, an article feature
including an article content type and an article landing page at 'article'
should set a context breadcrumb reaction on article node pages pointing to the
'article' menu item.

Currently context includes a menu class reaction but doesn't set the menu
trail.

See http://drupal.org/node/835090 for a potential menu trail context reaction.

In general, menu items should be treated as "soft" configuration and created
via API calls in hook_install().


6. Block visibility and theme regions
-------------------------------------

### 6.1 Block visibility

The Context module should be used wherever feasible for block placement and
visibility. 

### 6.2 Theme regions

Only the theme regions specified in kitf may be used. Pending a Drupal 7
version of kitf, those regions are:

* `content`
* `sidebar_first`
* `sidebar_second`

The sidebar_second region should be used primarily, with only occasional,
supplemental blocks being assigned to the sidebar_first region.


7. Dependencies
---------------
A feature may not depend on any feature that is not fully compliant with this
specification.

### Versions

Wherever feasible, features should use the recommended stable release versions
of contributed modules and themes.

### Libraries

Any external libraries used by a feature should be installed in a libraries
directory if possible.

### Patches

Patches should be avoided wherever possible. Ideally, patches should be used
only up to and including beta releases, to include functionality expected
to reach stable releases by the time the feature is out of beta.

Where feasible, patches should be replaced with workarounds in a feature's
.module file that use Drupal APIs to achieve the same ends. These workarounds
should include documentation identifying the patch that they relate to so
they can be removed if/when that patch is accepted.

### Drush make file

A feature should include a sample Drush make file including all the feature's
dependencies (modules, external libraries, etc.) that would typically be
installed with the feature.

To avoid being automatically processed by Drush Make, make files should end
with a .inc extension.

For example, a debut_wysiwyg feature might include debut_wysiwyg.make.inc
including the wysiwyg project, other required and optional modules, and a
WYSIWYG library like ckeditor.

To ensure that any modules or libraries declared in one feature don't duplicate
those in another, the following path convention must be used:

- contrib: used for all code in Drupal's version control
- external: used for modules, themes, etc. hosted externally, e.g., modules on
Github.

Examples:

; A drupal.org hosted project.
projects[views][subdir] = contrib
; An externally hosted project.
projects[seed][subdir] = external
projects[seed][location] = http://code.developmentseed.org/fserver


8. Content types and fields
---------------------------

Where a feature defines a content type, the following guidelines should be
followed:

### Image and other media fields

* If a single image is desired to represent each piece of content in the
content type, the content type should use field_content_image as used in e.g.
debut_article.
* If media (images, audio, video, files) are desired, the content type should
use field_media as used in e.g. debut_article.


9. Views
--------

For consistency, the following conventions should be used for views included in
features.

* Naming: if the view is primarily for presenting a single content type, it
should be named for the machine name of that content type.
* At a minimum, views of a content type should include a page, block, and
feed display, with the feed display attached to both the page and block. The
page display should have a path matching the content type's machine name
and the feed should have the same path with an .xml extension.


10. Contexts
------------

Where appropriate, features that define a content type should include a context
that displays related content on node pages of that content type. For example,
an event feature might display a calendar block and an upcoming events block
when event content is being viewed.

For consistency, unless there are extenuating reasons, such contextual blocks
should be placed in the sidebar_second region.


11. Help
--------

A feature may include contextual help provided through the Advanced Help
module covering major components of the feature.

File

debutf.txt
View source
  1. Debut Feature Specification (debutf 1.0-draft)
  2. ----------------------------------------------
  3. Extending the kitf feature specification, this document provides a set of
  4. requirements for Drupal features to provide suitable baseline functionality
  5. suitable to various distributions and individual site installs and at the
  6. same time integrate effectively into a cohesive feature set. Debut features
  7. should together provide an integrated set of functionality that covers the
  8. basic needs of most Drupal websites and distributions.
  9. This document is based on the Drupal 7.x versions of Drupal core, contributed
  10. modules and themes.
  11. 1. Introduction
  12. ---------------
  13. The kitf feature specification provides important guidelines and requirements
  14. to ensure interoperability among Drupal features.
  15. Building on kitf, Debut features are based on the following precepts:
  16. * Debut features should provide the basic functionality that most sites or
  17. distributions will need.
  18. * Any advanced or specialized functionality should be provided in separate
  19. features that require more basic features.
  20. * The ease of discovery and use of website feature for both admins and end
  21. users should be an overriding goal.
  22. * Every main task should have only one primary admin interface.
  23. * Common protocols and solutions should be used to ensure consistency and ease
  24. of use.
  25. ### Uniqueness and compatibility
  26. Wherever possible, each Debut feature should cover a unique area of
  27. functionality. For example, there should be only a single Debut feature
  28. that provides general blog functionality. Exceptions can be made where the
  29. underlying framework used is radically different and there is no common
  30. base to build on.
  31. ### Available on the Drupal infrastructure
  32. To ensure visibility, all Debut features should be hosted on the Drupal
  33. infrastructure.
  34. ### Declaring compliance
  35. Features compliant with this specification may declare themselves as such
  36. in their module `.info` file using the `debutf` key and the version of this
  37. document to which they comply. Example:
  38. debutf = "1.0-draft"
  39. ### Features framework
  40. A feature should meet its needs through Features-aware solutions wherever
  41. possible. Where multiple options exist, a primary selection criterion should be
  42. how fully they embrace the Features framework.
  43. - Context: Where context or contextual layout is required, the Context module
  44. should be used.
  45. - Boxes: Where custom blocks are required, the Boxes module must be used.
  46. - Strongarm: Where variables are set, the Strongarm module should be used.
  47. - Spaces: Where individual items (user spaces, pieces of content) require
  48. contextual customization, the Spaces module should be used.
  49. One of the most challenging tasks for novice site admins is controlling layout
  50. of individual sections or pages. The Panels module is a highly advanced and
  51. powerful solution for this purpose, but using Panels in combination with
  52. Context is demanding and error-prone. If e.g. a node type is overridden with
  53. a panel page, this panels page must be created by a single feature--barring
  54. custom coding, there is no easy way for other features to selectively add
  55. panes such that the overall panels page is constructed from the contributions
  56. of whatever other features are enabled. For this reason, Context rather than
  57. Panels seems the best overall choice for building displays in Debut.
  58. ### Standard solutions
  59. To help produce uniformity among the various Debut features, standard solutions
  60. are adopted across Debut. For example, for mapping, there are several Drupal
  61. modules available, e.g., Gmap, OpenLayers. To ensure consistency, one should
  62. be designated as the Debut standard.
  63. In selecting between alternatives, the Drupal principles
  64. (http://drupal.org/principles) are to be used as well as the following
  65. additional criteria:
  66. * Community open source: the candidate solution is a community-driven open
  67. source solution.
  68. * Non-proprietary: The candidate solution is not limited to, branded by, or
  69. controlled by a single company.
  70. * Data security: The candidate solution does not require posting data to an
  71. external source unless doing so is the explicit purpose.
  72. * Works out of the box without requiring manual configuration, e.g., entry of
  73. an API key.
  74. Before introducing a new Debut feature that introduces a dependency that could
  75. be considered as a new standard solution, an issue must be posted on the Debut
  76. project proposing the new standard solution with justification.
  77. Adopted standard solutions:
  78. - Captcha: where forms are protected from automated submission, the Captcha
  79. module should be used.
  80. - OpenLayers: where client side mapping is required, the OpenLayers Drupal
  81. module should be used.
  82. - Pathauto: where appropriate, paths variables should be set so that, if
  83. Pathauto is present, content types defined by a feature will get appropriate
  84. paths.
  85. - Rules should be used and not the core Trigger module for any configurable
  86. actions.
  87. ### Opportunity for peer review
  88. There should be an opportunity for review prior to a new Debut feature being
  89. posted. Such review will help ensure that new features indeed meet the Debut
  90. spec, e.g.,
  91. * identify any potential components that could/should be pulled into more
  92. specific Debut features,
  93. * identify properties that are too site-specific to warrant inclusion in Debut,
  94. * if the feature introduces a new solution to standardize (e.g., an external
  95. library or a way to structure particular data), ensure a consensus prior
  96. to adoption.
  97. Therefore each proposed Debut feature should be posted first as an issue on the
  98. Debut project, with a link to the sandbox version of the proposed feature and
  99. two weeks allowed for peer review prior to the new feature being promoted from
  100. a sandbox project to a full project on drupal.org.
  101. ### Soft vs. hard configuration
  102. A distinction should be made between "soft" and "hard" configuration.
  103. Soft configuration is likely to be changed on a given site and doesn't require
  104. or lend itself to updating in future code releases. Examples might include:
  105. - A variable that controls which content types receive social media links. This
  106. variable may be customized continuously as new content types are added to
  107. the site.
  108. Hard configuration is relatively unlikely to be customized on a given
  109. site and/or lends itself to updating in a future feature release. Hard
  110. configuration tends to be the core structure of a site. Examples might include:
  111. - Content types and their fields.
  112. - Views.
  113. Hard configuration is properly handled by export into Features components.
  114. However, soft configuration should live in the site database rather than code.
  115. In general, soft configuration should be handled in hook_install() using
  116. available API methods.
  117. 2. Namespaces
  118. -------------
  119. ### 2.1 Code namespace
  120. A Debut feature must include the debut namespace.
  121. - Example: `debut_blog`.
  122. ### 2.2 Project namespace
  123. A Debut project must include the debut namespace.
  124. - Example: `debut_blog`.
  125. 3. User roles and permissions
  126. -----------------------------
  127. ### 3.1 Required user roles
  128. The `administrator` role defined in kitf should be used for site administration
  129. tasks, such as installing and configuring modules, content types, and blocks.
  130. The administrator role is defined by the Debut feature and so should not be
  131. defined by any other Debut feature.
  132. In addition to the three roles defined in kitf, features should use the
  133. following two roles as appropriate.
  134. - `contributor` is a Drupal user who contributes content, e.g., a staff member
  135. at an organization or company.
  136. - `editor` is a Drupal user responsible for editing and administrating content,
  137. taxonomies, and comments.
  138. These roles are provided by the Debut feature and so will be present if Debut
  139. is installed. However, to avoid unwanted roles, Debut features should avoid
  140. requiring the Debut feature if feasible.
  141. A Debut feature may provide additional roles, but such roles should have a
  142. scope no greater than the scope of the feature. For example, a blog feature
  143. might provide a `blogger` role. However, a technology blog feature should not
  144. provide a `blogger` role, since that role would be relevant to a more general
  145. feature.
  146. ### 3.2 Permissions
  147. Because Features will remove an existing permission from any role not
  148. specified in an exported user permission, all permissions should be
  149. explicitly assigned to the `administrator` role.
  150. The editor role should not be expected to have `administer nodes` permissions.
  151. For each content type introduced, roles should be assigned as follows:
  152. - `contributor`: `create [type] content`, `delete own [type] content`, `edit
  153. own [type] content`
  154. - `editor`: `create [type] content`, `delete all [type] content`, `edit all
  155. [type] content`
  156. where [type] is the machine name of the content type being introduced by the
  157. feature.
  158. 4. Variables
  159. ------------
  160. A feature should include a settings form for any variables important to it.
  161. Doing so will facilitate Spaces integration.
  162. 5. Paths and breadcrumbs
  163. -----------------------
  164. ### 5.1 Primary path and nesting
  165. Where a feature provides content or nested pages, these should wherever
  166. feasible be available at paths nested below the feature's primary path.
  167. Without creating a dependency on Pathauto, a feature that defines a content
  168. type should register a pathauto pattern variable that nests content of that
  169. type below the feature's primary page.
  170. Example: a blog feature would use Strongarm to set pathauto_node_audio_pattern
  171. to 'blog/[title-raw]'.
  172. ### 5.2 Menu location and breadcrumbs
  173. Menu location and breadcrumbs for pages created by the feature should match the
  174. nesting used for paths.
  175. Context should be used to set breadcrumbs. For example, an article feature
  176. including an article content type and an article landing page at 'article'
  177. should set a context breadcrumb reaction on article node pages pointing to the
  178. 'article' menu item.
  179. Currently context includes a menu class reaction but doesn't set the menu
  180. trail.
  181. See http://drupal.org/node/835090 for a potential menu trail context reaction.
  182. In general, menu items should be treated as "soft" configuration and created
  183. via API calls in hook_install().
  184. 6. Block visibility and theme regions
  185. -------------------------------------
  186. ### 6.1 Block visibility
  187. The Context module should be used wherever feasible for block placement and
  188. visibility.
  189. ### 6.2 Theme regions
  190. Only the theme regions specified in kitf may be used. Pending a Drupal 7
  191. version of kitf, those regions are:
  192. * `content`
  193. * `sidebar_first`
  194. * `sidebar_second`
  195. The sidebar_second region should be used primarily, with only occasional,
  196. supplemental blocks being assigned to the sidebar_first region.
  197. 7. Dependencies
  198. ---------------
  199. A feature may not depend on any feature that is not fully compliant with this
  200. specification.
  201. ### Versions
  202. Wherever feasible, features should use the recommended stable release versions
  203. of contributed modules and themes.
  204. ### Libraries
  205. Any external libraries used by a feature should be installed in a libraries
  206. directory if possible.
  207. ### Patches
  208. Patches should be avoided wherever possible. Ideally, patches should be used
  209. only up to and including beta releases, to include functionality expected
  210. to reach stable releases by the time the feature is out of beta.
  211. Where feasible, patches should be replaced with workarounds in a feature's
  212. .module file that use Drupal APIs to achieve the same ends. These workarounds
  213. should include documentation identifying the patch that they relate to so
  214. they can be removed if/when that patch is accepted.
  215. ### Drush make file
  216. A feature should include a sample Drush make file including all the feature's
  217. dependencies (modules, external libraries, etc.) that would typically be
  218. installed with the feature.
  219. To avoid being automatically processed by Drush Make, make files should end
  220. with a .inc extension.
  221. For example, a debut_wysiwyg feature might include debut_wysiwyg.make.inc
  222. including the wysiwyg project, other required and optional modules, and a
  223. WYSIWYG library like ckeditor.
  224. To ensure that any modules or libraries declared in one feature don't duplicate
  225. those in another, the following path convention must be used:
  226. - contrib: used for all code in Drupal's version control
  227. - external: used for modules, themes, etc. hosted externally, e.g., modules on
  228. Github.
  229. Examples:
  230. ; A drupal.org hosted project.
  231. projects[views][subdir] = contrib
  232. ; An externally hosted project.
  233. projects[seed][subdir] = external
  234. projects[seed][location] = http://code.developmentseed.org/fserver
  235. 8. Content types and fields
  236. ---------------------------
  237. Where a feature defines a content type, the following guidelines should be
  238. followed:
  239. ### Image and other media fields
  240. * If a single image is desired to represent each piece of content in the
  241. content type, the content type should use field_content_image as used in e.g.
  242. debut_article.
  243. * If media (images, audio, video, files) are desired, the content type should
  244. use field_media as used in e.g. debut_article.
  245. 9. Views
  246. --------
  247. For consistency, the following conventions should be used for views included in
  248. features.
  249. * Naming: if the view is primarily for presenting a single content type, it
  250. should be named for the machine name of that content type.
  251. * At a minimum, views of a content type should include a page, block, and
  252. feed display, with the feed display attached to both the page and block. The
  253. page display should have a path matching the content type's machine name
  254. and the feed should have the same path with an .xml extension.
  255. 10. Contexts
  256. ------------
  257. Where appropriate, features that define a content type should include a context
  258. that displays related content on node pages of that content type. For example,
  259. an event feature might display a calendar block and an upcoming events block
  260. when event content is being viewed.
  261. For consistency, unless there are extenuating reasons, such contextual blocks
  262. should be placed in the sidebar_second region.
  263. 11. Help
  264. --------
  265. A feature may include contextual help provided through the Advanced Help
  266. module covering major components of the feature.