You are here

function uuid_features_settings in UUID Features Integration 7

Menu callback to configure module settings.

1 string reference to 'uuid_features_settings'
uuid_features_menu in ./uuid_features.module
Implements hook_menu().

File

./uuid_features.module, line 312
UUID Features module allows to export data stored in the db by features.

Code

function uuid_features_settings($form, &$form_state) {
  $form['settings']['uuid_features_vocabulary_terms'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto detect uuid terms'),
    '#description' => t('When exporting a vocabulary, include its terms.'),
    '#default_value' => variable_get('uuid_features_vocabulary_terms', FALSE),
  );
  $entity_info = entity_get_info();
  foreach ($entity_info as $type => $info) {
    if (!isset($info['uuid features']) || !$info['uuid features']) {
      unset($entity_info[$type]);
    }
  }
  foreach ($entity_info as $type => $info) {
    $options = array();
    $entities = array();
    $files = array();
    foreach ($info['bundles'] as $key => $value) {
      $options[$key] = $value['label'];
      $entities[$key] = variable_get("uuid_features_entity_{$type}_{$key}", FALSE);
      $files[$key] = variable_get("uuid_features_file_{$type}_{$key}", FALSE);
    }
    $form['entity']["uuid_features_entity_{$type}"] = array(
      '#type' => 'checkboxes',
      '#title' => t('Exportable @label bundles', array(
        '@label' => $info['label'],
      )),
      '#default_value' => $entities,
      '#options' => $options,
    );
    $form['file']["uuid_features_file_{$type}"] = array(
      '#type' => 'checkboxes',
      '#title' => t('Files exported for @label bundles', array(
        '@label' => $info['label'],
      )),
      '#default_value' => $files,
      '#options' => $options,
    );
  }
  $form['file']['uuid_features_file_mode'] = array(
    '#type' => 'radios',
    '#title' => t('File export mode'),
    '#default_value' => variable_get('uuid_features_file_mode', 'inline'),
    '#options' => array(
      'inline' => t('Inline Base64'),
      'local' => t('Local file export'),
      'packaged' => t('Package files with generated module.'),
      'remote' => t('Remote file export, URL'),
    ),
    '#description' => t('Should file exports be inline inside the export code, a local path to the file, or a URL? Inline Base64 is the easiest option to use but can sometimes exceed PHP post limits, local and remote modes are more useful for power users.  <em>NOTE: Remote mode only works with a public files directory.</em>'),
  );
  $form['file']['uuid_features_file_assets_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Local file field assets path'),
    '#size' => 60,
    '#maxlength' => 255,
    '#default_value' => variable_get('uuid_features_file_assets_path', ''),
    '#description' => t('Optionally, copy files to this path when the node is exported.
      The primary advantage of this is to divert exported files into a
      safe location so they can be committed to source control (eg: SVN,
      CVS, Git).  <em>Tip: For install profile developers, setting this
      path to <code>profiles/my_profile/uuid_features_assets</code> may be
      useful.</em>'),
    '#required' => FALSE,
    '#states' => array(
      'visible' => array(
        ':input[name=uuid_features_file_mode]' => array(
          'value' => 'local',
        ),
      ),
    ),
  );
  $form['file']['uuid_features_packaged_file_assets_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Packaged file field assets path'),
    '#size' => 60,
    '#maxlength' => 255,
    '#default_value' => variable_get('uuid_features_packaged_files_assets_path', 'assets'),
    '#description' => t("Copy files to this path, relative to the feature's export path,\n      when the entity is exported. The primary advantage of this is to\n      avoid the memory overhead of base64 encoding exported files."),
    '#required' => TRUE,
    '#states' => array(
      'visible' => array(
        ':input[name=uuid_features_file_mode]' => array(
          'value' => 'packaged',
        ),
      ),
    ),
  );
  $form['file']['uuid_features_file_supported_fields'] = array(
    '#type' => 'textfield',
    '#title' => t('Supported file field types'),
    '#default_value' => variable_get('uuid_features_file_supported_fields', 'file, image'),
    '#maxlength' => 512,
    '#description' => t('Comma seperated list of file field types to detect for export/import.'),
  );
  $form['settings']['uuid_features_vocabulary_terms'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto detect uuid terms'),
    '#description' => t('When exporting a vocabulary, include its terms.'),
    '#default_value' => variable_get('uuid_features_vocabulary_terms', FALSE),
  );
  $form['#submit'][] = 'uuid_features_settings_submit';
  return system_settings_form($form);
}