You are here

function metatags_quick_field_settings_form in Meta tags quick 7.2

Same name and namespace in other branches
  1. 7 metatags_quick.module \metatags_quick_field_settings_form()

Implements hook_field_settings_form().

File

./metatags_quick.module, line 474
Quick and dirty implementation of meta tags for drupal 7 Module defines new field type 'meta'. Fields of this type are not displayed in HTML. Instead, they add html meta to the head section.

Code

function metatags_quick_field_settings_form($field, $instance) {
  $settings = $field['settings'];
  if (empty($settings['meta_name'])) {
    preg_match('/field_(.*)/', $instance['field_name'], $matches);
    $settings['meta_name'] = $matches[1];
  }
  $form['meta_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Meta name'),
    '#default_value' => $settings['meta_name'],
    '#description' => t('Meta name (defaults to the field name)'),
    '#required' => TRUE,
  );
  $form['max_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length'),
    '#default_value' => isset($settings['max_length']) ? $settings['max_length'] : 255,
    '#required' => TRUE,
    '#description' => t('The maximum length of the field in characters.'),
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#disabled' => field_has_data($field),
  );
  return $form;
}