You are here

function fz152_entityform_form_variable_group_form_alter in FZ152 7

Implements hook_form_FORM_ID_alter().

File

module/entityform/fz152_entityform.module, line 69
Main file for hooks and custom functions. This module is provide integration with entityforms for fz152 module.

Code

function fz152_entityform_form_variable_group_form_alter(&$form, &$form_state, $form_id) {

  // Alter only for current module variable group settings.
  // We will hide weight fields before form will be selected.
  if (!empty($form['#variable_group_form']) && $form['#variable_group_form'] == 'fz152_entityform') {
    $entityforms = fz152_entityform_get_entityform_bundle_info();
    if (!empty($entityforms)) {
      foreach ($entityforms as $entityform) {
        $entityform_name = $entityform['name'];
        $form['fz152_entityform_form_' . $entityform_name . '_weight']['#states']['visible'] = array(
          'input[name="fz152_entityform_form_' . $entityform_name . '_enable"]' => array(
            'checked' => TRUE,
          ),
        );
      }
    }
  }
}