1 image.admin.inc image_style_add_form($form, &$form_state)

Form builder; Form for adding a new image style.

See also

image_style_add_form_submit()

Related topics

File

core/modules/image/image.admin.inc, line 222
Admin page callbacks for the Image module.

Code

function image_style_add_form($form, &$form_state) {
  backdrop_set_title(t('Add image style'));
  $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['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save and add effects'),
  );

  return $form;
}