You are here

function exif_admin_settings_form in Exif 7

Same name and namespace in other branches
  1. 5 exif.module \exif_admin_settings_form()
  2. 6 exif.admin.inc \exif_admin_settings_form()

The form definition for the admin settings

Return value

array form definition

1 string reference to 'exif_admin_settings_form'
exif_menu in ./exif.module
@author: Jean-Philippe Hautin

File

./exif.admin.inc, line 109

Code

function exif_admin_settings_form() {
  $forms = array();

  /*$forms['exif_granularity'] = array(
    '#type'	=>	'select',
    '#title'=>	t('Granularity'),
    '#options'=> array(0=>t('Default'),1=>('Day')),
    '#default_value'=>variable_get('exif_granularity',0),
    '#description'=>t('If a timestamp is select (for example the date the picture was taken), you can specify here how granular the timestamp should be. If you select default it will just take whatever is available in the picture. If you select Day, the Date saved will look something like 13-12-2008. This can be useful if you want to use some kind of grouping on the data.'),
    );*/
  $all_nodetypes = node_type_get_types();
  $all_nt = array();
  foreach ($all_nodetypes as $item) {
    $all_nt[$item->type] = $item->name;
  }
  $forms['exif_nodetypes'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Nodetypes'),
    '#options' => $all_nt,
    '#default_value' => variable_get('exif_nodetypes', array()),
    '#description' => t('Select nodetypes which should be checked for itpc & exif data. In case the nodetypes contains more than one image field, the module will use the first one.'),
  );
  if (module_exists("file_entity")) {
    $all_mt = array();

    // Setup media types
    if (function_exists('file_type_get_enabled_types')) {
      $types = file_type_get_enabled_types();
      foreach ($types as $key) {
        $all_mt[$key->type] = $key->label;
      }
    }
    else {
      if (function_exists('media_type_get_types')) {
        $types = media_type_get_types();
        foreach ($types as $key) {
          $all_mt[$key->name] = $key->name;
        }
      }
    }
    $forms['exif_mediatypes'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Mediatypes'),
      '#options' => $all_mt,
      '#default_value' => variable_get('exif_mediatypes', array()),
      '#description' => t('Select mediatypes which should be checked for itpc & exif data.'),
    );
  }
  $forms['exif_update'] = array(
    '#type' => 'checkbox',
    '#title' => t('Refresh on node update'),
    '#default_value' => variable_get('exif_update', TRUE),
    '#description' => t('If you enable this option, Exif data is being updated when the node is being updated.'),
  );
  $forms['exif_extraction_solution'] = array(
    '#type' => 'select',
    '#title' => t('metadata extraction solution to use on node update'),
    '#options' => \Drupal\exif\ExifFactory::getExtractionSolutions(),
    '#default_value' => variable_get('exif_extraction_solution', "php_extensions"),
    '#description' => t('Choose between Exif PHP Extension or call to external tool <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">exiftool</a>.'),
  );
  $forms['exif_exiftool_location'] = array(
    '#type' => 'textfield',
    '#title' => t('location of exiftool binary'),
    '#default_value' => variable_get('exif_exiftool_location', "exiftool"),
    '#description' => t('where is the exiftool binaries (only needed if extraction solution chosen is exiftool)'),
  );
  $forms['exif_empty_values'] = array(
    '#type' => 'checkbox',
    '#title' => t('Write empty image data?'),
    '#default_value' => variable_get('exif_empty_values', TRUE),
    '#description' => t("If checked all values will be written. So for example if you want to read the creation date from EXIF, but it's not available, it will just write an empty string. If unchecked, empty strings will not be written. This might be the desired behavior, if you have a default value for the CCK field."),
  );
  $all_vocabularies = taxonomy_get_vocabularies();
  $all_vocs = array();
  $all_vocs[0] = 'None';
  foreach ($all_vocabularies as $item) {
    $all_vocs[$item->vid] = $item->name;
  }
  $forms['exif_vocabulary'] = array(
    '#type' => 'select',
    '#title' => t('Vocabulary'),
    '#options' => $all_vocs,
    '#default_value' => variable_get('exif_vocabulary', array()),
    '#description' => t('Select vocabulary which should be used for itpc & exif data.'),
  );

  //TODO: add a button to create a vocabulary "photographies'metadata" (exif,iptc and xmp data contains in jpef file)

  //TODO : add a button to create an Photography node with default exif field (title,model,keywords) and default behavior but 'promoted to front'

  //TODO : Check if the media module is install to add automatically the image type active and add active default exif field (title,model,keywords).
  return system_settings_form($forms);
}