Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Field helper provides two additional install-time hooks for defining fields and instances as well as two functions to invoke the installation and uninstallation of those definitions.
The following is an example .install file for a module named "example".
/**
* Implements hook_install().
*/
function example_install() {
field_helper_install_all('example');
}
/**
* Implements hook_uninstall().
*/
function example_uninstall() {
field_helper_uninstall_all('example');
}
/**
* Implements hook_install_fields().
*/
function example_install_fields() {
return array(
'some_field' => array(
'field_name' => 'some_field',
'type' => 'text_long',
),
);
}
/**
* Implements hook_install_instances().
*/
function example_install_instances() {
$t = get_t();
return array(
'some_field' => array(
'entity_type' => 'node',
'bundle' => 'some_node_type',
'field_name' => 'some_field',
'label' => $t('Some field'),
'description' => $t('Some field description.'),
'widget' => array(
'type' => 'text_textarea',
),
),
);
}
Project information
- 1 site reports using this module
- By boombatower on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
7.x-1.1
released 20 January 2011
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.
Development version: 7.x-1.x-dev updated 6 Jul 2016 at 20:22 UTC