drupal-eca-recipe / article_content_type
Provides the Article content type and related configuration. Use <em>articles</em> for time-sensitive content like news, press releases or blog posts. The body is a formatted long text field without a summary.
Package info
gitlab.lakedrops.com/drupal/recipes/article_content_type
Type:drupal-recipe
pkg:composer/drupal-eca-recipe/article_content_type
Requires
- drupal/core: ^11 || ^12
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This recipe creates the Article content type with the configuration a site
normally expects around it: the body field, the field_image image field, a
promote base field override that defaults to promoted, the Article form
display, and the default, RSS and teaser view displays. It also imports the
node view modes, node actions and image styles that the Standard profile used
to install, so a site built from Minimal ends up with the same Article
experience.
Why this recipe exists
Drupal 11.4.0 dropped the Article and Basic page content types from the
Standard profile, so new sites no longer get them out of the box. See
https://www.drupal.org/node/3590571. The follow-up issue
https://www.drupal.org/project/drupal/issues/3608069 restored the
article_content_type, page_content_type and article_tags recipes, but on
the 11.x branch only. Drupal 12 ships no successor: those recipes are gone and
nothing in core replaces them.
Many models in the ECA library assume an Article content type. Rather than depend on something that exists in one major version and not the next, the library ships its own copy. This recipe is that copy: the core 11.x recipe, with one deliberate difference in the body field.
The body field
Core's version of this recipe gives body the text_with_summary field type,
which offers a separate summary alongside the main text. Drupal 12 removed that
field type from core, see https://www.drupal.org/node/3568381. It lives on in
the contributed Text With Summary module,
https://www.drupal.org/project/text_with_summary.
This recipe uses plain text_long from the text module instead, and never
installs Text With Summary. What follows from that:
- The widget is
text_textareawith nine rows, nottext_textarea_with_summary. - The teaser formatter is
text_trimmed, nottext_summary_or_trimmed. - Editors maintain a single formatted long text value and no separate teaser text.
A site that already has a body field storage of another type, typically
text_with_summary from a Standard install predating Drupal 11.4, cannot apply
this recipe: the storage is compared strictly, so the recipe stops before
creating anything, and a field's type cannot be changed once it exists. Such a
site keeps its own content types and does not need this recipe. Configuration
already on the site that matches what this recipe ships is kept, not overwritten.
Including it from another recipe
recipes:
- article_content_type
The bare name resolves to a sibling directory of the recipe being applied,
which is where Composer installs drupal-recipe packages. Composer does not
process the recipes: list on its own, so the including recipe requires
drupal-eca-recipe/article_content_type in its composer.json. Modeler API's
recipe export writes that requirement since
issue #3588524 in
releases after 1.1.7; a hand-written recipe adds it itself.
Installation
composer require drupal-eca-recipe/article_content_type
drush recipe ../recipes/article_content_type
# Without Drush:
cd web && php core/scripts/drupal recipe ../recipes/article_content_type
drush cr