You are here

function field_group_validate_css_class in Field Group 7.2

Same name and namespace in other branches
  1. 8 includes/helpers.inc \field_group_validate_css_class()
  2. 7 field_group.field_ui.inc \field_group_validate_css_class()

Validate the entered css class from the submitted format settings.

Parameters

Array $element The validated element:

Array $form_state The state of the form.:

2 string references to 'field_group_validate_css_class'
field_group_field_group_format_settings in ./field_group.module
Implements hook_field_group_format_settings(). If the group has no format settings, default ones will be added. @params Object $group The group object.
hook_field_group_format_settings in ./field_group.api.php
Implements hook_field_group_format_settings().

File

./field_group.field_ui.inc, line 652
Field_group.field_ui.inc is a file that contains most functions needed on the Fields UI Manage forms (display and fields).

Code

function field_group_validate_css_class($element, &$form_state) {
  if (!empty($form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['classes']) && !preg_match('!^[A-Za-z0-9-_ ]+$!', $form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['classes'])) {
    form_error($element, t('The css class must include only letters, numbers, underscores and dashes.'));
  }
}