You are here

function word_link_exists in Word Link 7.2

Verify by text if link already exists.

Parameters

string $text: Word text which need to find.

int $id: (optional) ID of the word.

Return value

object Returns the word object if exist or FALSE if not.

2 calls to word_link_exists()
word_link_exchange_import_from_file in modules/word_link_exchange/word_link_exchange.module
Import links from file to DB.
word_link_exchange_import_from_taxonomy in modules/word_link_exchange/word_link_exchange.module
Import links from taxonomy terms to DB.

File

./word_link.module, line 646

Code

function word_link_exists($text, $id = 0) {
  $query = db_select('word_link', 'wl')
    ->fields('wl', array(
    'text',
    'case_sensitive',
    'id',
  ))
    ->condition('id', $id, '!=')
    ->condition('text', $text, '=');
  $word = $query
    ->execute()
    ->fetchAssoc();
  return $word ? (object) $word : $word;
}