You are here

public function MetatagTestBase::getTranslationLidBySource in Metatag 7

Get the {locales_source} lid value for a specific source.

Parameters

string $string: The translation string to search for.

string $textgroup: This string's textgroup; defaults to 'metatag'.

Return value

int The {locales_source}.lid value for this string.

1 call to MetatagTestBase::getTranslationLidBySource()
MetatagCoreLocaleTest::testNodeFormTranslations in tests/MetatagCoreLocaleTest.test
Test that the node form meta tag fields are translated correctly.

File

tests/MetatagTestBase.test, line 387
A base class for the Metatag tests, provides shared methods.

Class

MetatagTestBase
A base class for the Metatag tests, provides shared methods.

Code

public function getTranslationLidBySource($string, $textgroup = 'metatag') {

  // Extra debug output.
  $this
    ->debugLocalesSourcesByContext('', $textgroup);

  // Look for the string that's actually being requested.
  return (int) db_query("SELECT lid\n      FROM {locales_source}\n      WHERE textgroup = :textgroup\n      AND source = :source", array(
    ':textgroup' => $textgroup,
    ':source' => $string,
  ))
    ->fetchField();
}