function StringDatabaseStorage::dbStringKeys
Same name in other branches
- 9 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringKeys()
- 8.9.x core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringKeys()
- 10 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringKeys()
Gets keys values that are in a database table.
Parameters
\Drupal\locale\StringInterface $string: The string object.
Return value
array Array with key fields if the string has all keys, or empty array if not.
2 calls to StringDatabaseStorage::dbStringKeys()
- StringDatabaseStorage::dbStringUpdate in core/
modules/ locale/ src/ StringDatabaseStorage.php - Updates string object in the database.
- StringDatabaseStorage::delete in core/
modules/ locale/ src/ StringDatabaseStorage.php
File
-
core/
modules/ locale/ src/ StringDatabaseStorage.php, line 292
Class
- StringDatabaseStorage
- Defines a class to store localized strings in the database.
Namespace
Drupal\localeCode
protected function dbStringKeys($string) {
if ($string->isSource()) {
$keys = [
'lid',
];
}
elseif ($string->isTranslation()) {
$keys = [
'lid',
'language',
];
}
if (!empty($keys) && ($values = $string->getValues($keys)) && count($keys) == count($values)) {
return $values;
}
else {
return [];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.