New fields aren't created after updating a custom module. DRUPAL 7 -
i have custom module on site. try install update new field vocabulary, field doesn't appear. hook_update:
function mymodule_update_7118() { $field_name = 'field_newfield'; if ( field_info_field( $field_name ) ) { return; } $field = array( 'field_name' => $field_name, 'type' => 'list_integer', 'settings' => array( 'allowed_values' => array( 'yes' => 1, //heard adding no value may cause problems, although doesn't work no value either. ), ), ); $field = field_create_field( $field ); $instance = array( 'field_name' => $field['field_name'], 'entity_type' => 'taxonomy', 'bundle' => 'vocab_name', 'label' => 'label', 'widget' => array( 'active' => 1, 'module' => 'options', 'settings' => array(), 'type' => 'options_select', 'weight' => '3', ), ); field_create_instance($instance); }
logs contain several recordings of internalization module creating string translate field. needed tables created in database, empty.
for creating new custom field must custom module. steps can found out @ https://drupal.stackexchange.com/questions/140517/how-to-create-new-field-type
you can find excellent field_example module examples module first place look. examples module can downloaded https://www.drupal.org/project/examples
Comments
Post a Comment