You are here

function picture_ckeditor_settings_validate in Picture 7

Validate handler for the picture_ckeditor_settings form. It checks that a fallback image style is selected for every picture group that has been enabled for the CKEditor image dialog.

File

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

Code

function picture_ckeditor_settings_validate($form, &$form_state) {
  $picture_groups = picture_mapping_load();
  $ckeditor_groups = array();
  foreach ($picture_groups as $picture_group) {
    $machine_name = $picture_group->machine_name;
    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 group'));
      }
    }
  }
}