You are here

function splashify_where_paths_check in Splashify 7

Same name and namespace in other branches
  1. 6 admin/splashify.admin.where.inc \splashify_where_paths_check()

Validate the where:list:paths field.

We put this in a function so it can handle both the desktop and mobile settings. This assumes that each path in $paths is separated by a new line character.

File

admin/splashify.admin.where.inc, line 196
The admin "Where" tab.

Code

function splashify_where_paths_check($field, $paths) {
  return true;
  $what_paths = preg_split('/[\\n\\r]+/', $paths);
  $errors = array();
  foreach ($what_paths as $path) {

    // If this path is a source url, we know this is a valid path.
    if (drupal_valid_path($path)) {
      continue;
    }

    // This path is not an alias or the source url.
    $errors[] .= t('The path "@path" is not a valid source page. This path cannot be an alias.', array(
      '@path' => $path,
    ));
  }

  // Since there could be multiple errors for this one field, we want to
  // break each error into a separate line.
  if (count($errors) > 0) {
    form_set_error($field, implode('<br />', $errors));
  }
}