You are here

function resp_img_add_style_form in Responsive images and styles 7

1 string reference to 'resp_img_add_style_form'
resp_img_menu in ./resp_img.module
Implements hook_menu().

File

./resp_img.admin.inc, line 73
Admin settings

Code

function resp_img_add_style_form($form, &$form_state) {
  module_load_include('inc', 'image', 'image.admin');
  $form['style'] = array(
    '#title' => t('Image style'),
    '#type' => 'select',
    '#options' => image_style_options(FALSE),
    '#required' => TRUE,
    '#description' => t('This image style will be cloned to create the responsive style'),
  );
  $form['base_name'] = array(
    '#type' => 'textfield',
    '#size' => '64',
    '#title' => t('Image style base name'),
    '#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
    '#element_validate' => array(
      'image_style_name_validate',
    ),
    '#required' => TRUE,
  );
  $suffixes = resp_img_suffix_load_all();
  $options = array();
  $options[variable_get('resp_img_default_suffix', '')] = t('Default') . ' (' . variable_get('resp_img_default_suffix', '') . ')';
  foreach ($suffixes as $suffix) {
    $options[$suffix->suffix] = $suffix->label . ' (' . $suffix->suffix . ')';
  }
  $form['suffixes'] = array(
    '#title' => t('Suffixes'),
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => drupal_map_assoc(array_keys($options)),
    '#description' => t('Select the suffixes to create an image style for'),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Create'),
  );
  return $form;
}