You are here

function word_link_get_link_text in Word Link 8

Verify by text if link already exists.

3 calls to word_link_get_link_text()
word_link_add_form_validate in ./word_link.admin.inc
Validate form for add or edit page.
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 335
This module allows users to replace previously defined words to the links.

Code

function word_link_get_link_text($text, $id = 0) {
  if ($text) {
    $result = db_select('word_link', 'wl')
      ->fields('wl', array(
      'text',
      'case_sensitive',
    ))
      ->condition('id', $id, '!=')
      ->condition('text', $text, '=')
      ->execute()
      ->fetchAll();
  }
  if (empty($result)) {
    return FALSE;
  }
  if (count($result) > 1) {
    return TRUE;
  }
  elseif (drupal_strtolower($text) == drupal_strtolower($result[0]->text)) {
    return TRUE;
  }
  return FALSE;
}