function icon_bundle_overview_form_validate in Icon API 8
Same name and namespace in other branches
- 7 includes/admin.inc \icon_bundle_overview_form_validate()
Validate callback for 'icon_bundle_overview_form'.
File
Code
function icon_bundle_overview_form_validate($form, $form_state) {
// Ensure only authorized users can submit the form.
if (!\Drupal::currentUser()
->hasPermission('administer icons')) {
form_set_error('', t('You are not authorized to submit this form.'));
}
$view_path_alias = $form_state['values']['icon_api_view_path_alias'];
// @FIXME
// menu_get_item() has been removed. To retrieve route information, use the
// RouteMatch object, which you can retrieve by calling \Drupal::routeMatch().
//
//
// @see https://www.drupal.org/node/2203305
// if ($form['global']['icon_api_view_path_alias']['#default_value'] !== $form_state['values']['icon_api_view_path_alias'] && menu_get_item($view_path_alias)) {
// form_set_error('icon_api_view_path_alias', t('The view path alias provided, "%url", is already in use. Please enter a different path.', array(
// '%url' => $view_path_alias,
// )));
// }
}