You are here

function views_bootstrap_gallery_plugin_style_bootstrap_gallery::options_validate in Bootstrap - Photo Gallery 7.3

Validate option form.

Overrides views_plugin_style::options_validate

File

./views_bootstrap_gallery_plugin_style_bootstrap_gallery.inc, line 90
Contains the Bootstrap Gallery style plugin.

Class

views_bootstrap_gallery_plugin_style_bootstrap_gallery
Style plugin to render each item in an ordered or unordered list.

Code

function options_validate(&$form, &$form_state) {

  // Don't run validation on style plugins without the grouping setting.
  if (isset($form_state['values']['style_options']['bootstrap_gallery']) && ($options = $form_state['values']['style_options']['bootstrap_gallery'])) {
    $image_field = $options['image_field'];
    $field_info = field_info_field($image_field);
    $allowed_field_types = array(
      'image',
      'file',
    );
    if (!in_array($field_info['type'], $allowed_field_types)) {
      form_set_error('style_options[bootstrap_gallery][image_field]', t('Selected image field must be of type: Image'));
    }
  }
}