function breakpoints_add_style_form in Breakpoints 7
1 string reference to 'breakpoints_add_style_form'
- breakpoints_menu in ./
breakpoints.module - Implements hook_menu().
File
- ./
breakpoints.admin.inc, line 627 - Breakpoints - admin settings
Code
function breakpoints_add_style_form($form, &$form_state) {
module_load_include('inc', 'image', 'image.admin');
$form['style'] = array(
'#title' => t('Image style'),
'#type' => 'select',
'#options' => array_filter(image_style_options(FALSE), '_breakpoints_filter_styles'),
'#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,
);
$breakpoints = breakpoints_breakpoint_load_all_active();
if (isset($breakpoints) && !empty($breakpoints)) {
$options = array();
foreach ($breakpoints as $breakpoint) {
foreach ($breakpoint->multipliers as $multiplier) {
$options[str_replace('.', '_', $breakpoint->machine_name . '_' . $multiplier)] = $breakpoint->name . ' [' . $breakpoint->breakpoint . ', multiplier:' . $multiplier . ']';
}
}
$form['breakpoints'] = array(
'#title' => t('breakpoints'),
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => drupal_map_assoc(array_keys($options)),
'#description' => t('Select the breakpoints to create an image style for'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create'),
);
}
else {
$form['redirect_link'] = array(
'#markup' => t("You need to create a breakpoint first before creating a responsive style. ") . l('Click here', 'admin/config/media/breakpoints') . t(" to continue with configuring breakpoints."),
);
}
return $form;
}