You are here

function _entityform_alias_is_used in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.module \_entityform_alias_is_used()
1 call to _entityform_alias_is_used()
entityform_entity_presave in ./entityform.module
Implements hook_entity_presave().

File

./entityform.module, line 887
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function _entityform_alias_is_used($path) {

  // Ensure that the submitted alias does not exist yet.
  $query = db_select('url_alias')
    ->condition('alias', $path['alias'])
    ->condition('language', $path['language']);
  if (!empty($path['source'])) {
    $query
      ->condition('source', $path['source'], '<>');
  }
  $query
    ->addExpression('1');
  $query
    ->range(0, 1);
  if ($query
    ->execute()
    ->fetchField()) {
    return TRUE;
  }
  return FALSE;
}