You are here

function field_group_validate_id in Field Group 7

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

Validate the entered id attribute from the submitted format settings.

Parameters

Array $element The validated element:

Array $form_state The state of the form.:

1 string reference to 'field_group_validate_id'
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.

File

./field_group.field_ui.inc, line 706
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_id($element, &$form_state) {
  if (!empty($form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['id']) && !preg_match('!^[A-Za-z0-9-_]+$!', $form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['id'])) {
    form_error($element, t('The id must include only letters, numbers, underscores and dashes.'));
  }
}