You are here

function picture_admin_settings_validate in Picture 7.2

Validate handler for the picture_ckeditor_settings form.

It checks that a fallback image style is selected for every picture mapping that has been enabled for the CKEditor image dialog.

File

./picture.admin.inc, line 349
Picture - map breakpoints and image styles.

Code

function picture_admin_settings_validate($form, &$form_state) {
  $picture_mappings = picture_mapping_load_all();
  if ($picture_mappings) {
    foreach ($picture_mappings as $picture_mapping) {
      $machine_name = $picture_mapping
        ->getMachineName();
      if ($form_state['values'][$machine_name]['enabled'] == 1) {
        if (empty($form_state['values'][$machine_name]['fallback'])) {
          form_set_error($machine_name . '][fallback', t('Please choose a fallback image style for this picture mapping'));
        }
      }
    }
  }
}