You are here

function services_edit_form_endpoint_resources_validate in Services 6.3

Same name and namespace in other branches
  1. 7.3 plugins/export_ui/services_ctools_export_ui.class.php \services_edit_form_endpoint_resources_validate()

services_edit_form_endpoint_resources_validate function.

_state

Parameters

array $form:

Return value

void

File

plugins/export_ui/services_ctools_export_ui.class.php, line 375
Export-ui handler for the Services module.

Code

function services_edit_form_endpoint_resources_validate($form, &$form_state) {
  $input = $form_state['values'];

  // Validate aliases.
  foreach ($input['resources'] as $resource_name => $resource) {
    if (!empty($resource['alias']) && !preg_match('/^[a-z-_]+$/', $resource['alias'])) {

      // Still this doesn't highlight needed form element.
      form_set_error("resources][{$resource_name}][alias", t("The alias for the !name resource may only contain lower case a-z, underscores and dashes.", array(
        '!name' => $resource_name,
      )));
    }
  }
}