function image_style_add_form

Form builder; Form for adding a new image style.

See also

image_style_add_form_submit()

Related topics

1 string reference to 'image_style_add_form'
image_menu in drupal/modules/image/image.module
Implements hook_menu().

File

drupal/modules/image/image.admin.inc, line 242
Administration pages for image settings.

Code

function image_style_add_form($form, &$form_state) {
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Style name'),
    '#default_value' => '',
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#description' => t('The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).'),
    '#size' => '64',
    '#required' => TRUE,
    '#machine_name' => array(
      'exists' => 'image_style_load',
      'source' => array(
        'label',
      ),
      'replace_pattern' => '[^0-9a-z_\\-]',
      'error' => t('Please only use lowercase alphanumeric characters, underscores (_), and hyphens (-) for style names.'),
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Create new style'),
  );
  return $form;
}