You are here

function _conditional_fields_admin in Conditional Fields 5

Same name and namespace in other branches
  1. 6.2 conditional_fields.module \_conditional_fields_admin()
  2. 6 conditional_fields.module \_conditional_fields_admin()

Administration form for conditional fields

1 string reference to '_conditional_fields_admin'
conditional_fields_menu in ./conditional_fields.module
Implementation of hook_menu().

File

./conditional_fields.module, line 56

Code

function _conditional_fields_admin($type) {
  $form = array();
  $options = array(
    C_FIELDS_JS_NO => t("Don't use javascript. Fields are only hidden on node view."),
    C_FIELDS_JS_HIDE => t('Hide untriggered fields.'),
    C_FIELDS_JS_DISABLE => t('Disable untriggered fields.'),
  );
  $form['js_set'] = array(
    '#type' => 'fieldset',
    '#title' => t('User Interface options'),
    '#description' => t('Choose the desired javascript behaviour in node editing forms.'),
    '#collapsible' => TRUE,
  );
  $form['js_set']['js'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => variable_get('c_fields_js_' . $type, C_FIELDS_JS_HIDE),
  );
  $form['orphaned'] = array(
    '#type' => 'fieldset',
    '#title' => t('Orphaned controlled fields settings'),
    '#description' => t('Configure the visibility/editability of controlled fields whose controlling fields are not visible/editable.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $options = array(
    C_FIELDS_ORPHANED_HIDE => t('Hide'),
    C_FIELDS_ORPHANED_SHOW_TRIGGERED => t('Show only triggered'),
    C_FIELDS_ORPHANED_SHOW_ALL => t('Show all'),
  );
  $form['orphaned']['orphaned_view'] = array(
    '#type' => 'radios',
    '#title' => t('On node view'),
    '#options' => $options,
    '#default_value' => variable_get('c_fields_view_' . $type, C_FIELDS_ORPHANED_SHOW_TRIGGERED),
  );
  $form['orphaned']['orphaned_edit'] = array(
    '#type' => 'radios',
    '#title' => t('On node edit'),
    '#options' => $options,
    '#default_value' => variable_get('c_fields_edit_' . $type, C_FIELDS_ORPHANED_SHOW_TRIGGERED),
  );
  $form['show_all'] = array(
    '#type' => 'checkbox',
    '#title' => t('Administrators see all fields'),
    '#description' => t('Select this box to let users with the <a href="@access-control-page">administer conditional fields</a> permission to view all controlled fields of a node.', array(
      '@access-control-page' => url('admin/user/access', NULL, 'module-conditional_fields'),
    )),
    '#default_value' => variable_get('c_fields_show_all_' . $type, 0),
  );
  $form['reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset'),
    '#description' => t('Delete all conditional fields configured for this content type. This will delete the conditional fields settings, not the fields themselves.'),
    '#default_value' => 0,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  return $form;
}