I've extended a feature (using Feature module) by adding a new field in the settings form:

  $form['custom_user']['user_value'] = array (
    '#type' => 'textfield',
    '#title' => t('user_value'),
    '#size' => 30,
    '#maxlength' => 128,
    '#default_value' => variable_get('user_value', 'My Value'),

Now I have added a hook update

function myfeature_update_7310() {
  variable_set('user_value', 'My Value');

Now the websites using this feature already have the first version. is it required to add somehow the new field creation as well in my hook_update_N?

  • If the field already exists then no - your new element will appear in the expected place, probably without even a cache clear – Clive Jun 10 '14 at 13:58
  • No the field does not exists. Should then use field_create_field('user_value'); inside the hook_update_N? This field is in the setting .inc file containing the form setting. – drupal_stuff_alter Jun 10 '14 at 14:13
  • If it's a feature module won't features be adding it though? – Clive Jun 10 '14 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.