You are here

function _jquery_carousel_config_validate in jQuery carousel 8

Same name and namespace in other branches
  1. 7 jquery_carousel.module \_jquery_carousel_config_validate()

Validation logic for carousel config

2 calls to _jquery_carousel_config_validate()
jCarouselFieldFormatter::jqueryCarouselSelectorValidate in src/Plugin/Field/FieldFormatter/jCarouselFieldFormatter.php
Element validate; Check selector is valid.
JqueryCarousel::validateOptionsForm in src/Plugin/views/style/JqueryCarousel.php
Validate the options form.

File

./jquery_carousel.module, line 27
Provide jquery carousel style plugin for views.

Code

function _jquery_carousel_config_validate($selector) {
  $error = FALSE;
  preg_match('/[a-zA-Z|-]*/', $selector, $matches);
  if (count($matches) !== 1 || $matches[0] !== $selector) {
    $error = TRUE;
  }
  return $error;
}