Fix excerpts on blog posts

This commit is contained in:
Oliver Davies 2018-12-31 12:13:05 +00:00
parent 429c373db7
commit ff9f0a7b0b
124 changed files with 187 additions and 604 deletions

View file

@ -1,19 +1,16 @@
---
title: Turning Your Custom Drupal Module into a Feature
excerpt: How to turn a custom Drupal module into a Feature.
tags:
- drupal
- drupal-7
- drupal-planet
- features
---
{% block excerpt %}
Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesnt get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so werent present within the standard installation profile used to run tests.
I decided to convert the custom module into a [Feature][0] so that the content type and its fields could be added to it, and therefore present on the testing site once the module is installed.
{% endblock %}
{% block content %}
To do this, I needed to expose the module to the Features API.
All thats needed is to add this line to the `mymodule.info` file:
@ -25,6 +22,5 @@ features[features_api][] = api:2
After clearing the cache, the module is now visible in the Features list - and ready to have the appropriate configuration added to it.
!['The features list showing the custom module'](/images/blog/custom-module-as-a-feature.png)
{% endblock %}
[0]: https://www.drupal.org/project/features