function flickr_context_tags_settings() { $form = array(); $mt_ns = variable_get('flickr_context_tags_mech_namespace', ''); //Make a qualified guess if (empty($mt_ns)) { $matches = array(); $site_name = variable_get('site_name', ''); if (preg_match('/^\\s*([^\\s\\.]+)/', $site_name, $matches)) { $mt_ns = drupal_strtolower($matches[1]); } } $form['flickr_context_tags_mech_namespace'] = array('#type' => 'textfield', '#title' => t('Machine-tag namespace'), '#default_value' => $mt_ns); $form['flickr_context_tags_userid'] = array('#type' => 'textfield', '#title' => t('Flickr id'), '#description' => t('Can be used to get photos from a specified flickr user'), '#default_value' => variable_get('flickr_context_tags_userid', '')); $form['flickr_context_tags_default_place_id'] = array('#type' => 'textfield', '#title' => t('Default place id'), '#description' => t('The default place id can be used to keep the flickr pictures relevant'), '#default_value' => variable_get('flickr_context_tags_default_place_id', '')); $form['flickr_context_tags_force_default_place_id'] = array('#type' => 'checkbox', '#title' => t('Always use the default place id'), '#default_value' => variable_get('flickr_context_tags_force_default_place_id', FALSE)); $sizes = array('s' => t('Square'), 't' => t('Thumbnail'), 'm' => t('Small'), '-' => t('Medium'), 'b' => t('Large'), 'o' => t('Orginal')); $form['flickr_context_tags_size'] = array('#type' => 'select', '#title' => t('Select the size you want your photos in'), '#default_value' => variable_get('flickr_context_tags_size', 'm'), '#options' => $sizes); // Tag configuration textarea $paths = variable_get('flickr_context_tags_contexts', array()); $form['flickr_context_tags_contexts'] = array('#type' => 'textarea', '#title' => t('Context tags for paths'), '#default_value' => flickr_context_tags_pack_contexts($paths), '#description' => t('Enter the path expression followed by a list of comma-separated tags')); // Piggyback on the system settings form for buttons and so on $form = system_settings_form($form); // ...but replace the #submit function $form['#submit'] = array('flickr_context_tags_settings_submit'); return $form; }
function flickr_context_tags_settings() { $form = array(); // Set machine tag name space to current domain, if not already set $url = parse_url(url('', array('absolute' => TRUE))); $mt_ns = variable_get('flickr_context_tags_mech_namespace', $url['host']); $form['flickr_context_tags_mech_namespace'] = array('#type' => 'textfield', '#title' => t('Machine-tag namespace'), '#default_value' => $mt_ns); $form['flickr_context_tags_userid'] = array('#type' => 'textfield', '#title' => t('Flickr id'), '#description' => t('Can be used to get photos from a specified flickr user'), '#default_value' => variable_get('flickr_context_tags_userid', '')); $form['flickr_context_tags_default_place_id'] = array('#type' => 'textfield', '#title' => t('Default place id'), '#description' => t('The default place id can be used to keep the flickr pictures relevant'), '#default_value' => variable_get('flickr_context_tags_default_place_id', '')); $form['flickr_context_tags_force_default_place_id'] = array('#type' => 'checkbox', '#title' => t('Always use the default place id'), '#default_value' => variable_get('flickr_context_tags_force_default_place_id', FALSE)); $sizes = array('s' => t('Square'), 't' => t('Thumbnail'), 'm' => t('Small'), '-' => t('Medium'), 'b' => t('Large'), 'o' => t('Orginal')); $form['flickr_context_tags_size'] = array('#type' => 'select', '#title' => t('Select the size you want your photos in'), '#default_value' => variable_get('flickr_context_tags_size', 'm'), '#options' => $sizes); // Tag configuration textarea $paths = variable_get('flickr_context_tags_contexts', array()); $form['flickr_context_tags_contexts'] = array('#type' => 'textarea', '#title' => t('Context tags for paths'), '#default_value' => flickr_context_tags_pack_contexts($paths), '#description' => t('Enter the path expression followed by a list of comma-separated tags')); // Piggyback on the system settings form for buttons and so on $form = system_settings_form($form); // ...but replace the #submit function $form['#submit'] = array('flickr_context_tags_settings_submit'); return $form; }