public static function Generic::isTranslation in Drupal 7 to 8/9 Module Upgrader 8
Checks if a field lookup key is translated. This will be TRUE unless one of the following conditions applies:
- The key is the Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED constant.
- The key is the LANGUAGE_NONE constant from Drupal 7.
- The key is the string 'und'.
Parameters
\Pharborist\Node $key: The key to check.
Return value
bool
1 call to Generic::isTranslation()
- Generic::rewriteFieldLookup in src/
Plugin/ DMU/ Rewriter/ Generic.php - Rewrites a Drupal 7 field lookup like so:
File
- src/
Plugin/ DMU/ Rewriter/ Generic.php, line 288
Class
- Generic
- Plugin annotation @Rewriter( id = "_rewriter", deriver = "\Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\GenericDeriver" )
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\RewriterCode
public static function isTranslation(Node $key) {
if ($key instanceof ClassConstantLookupNode) {
$constant = $key
->getClassName() . '::' . $key
->getConstantName();
return $constant != '\\Drupal\\Core\\Language\\Language::LANGCODE_NOT_SPECIFIED';
}
elseif ($key instanceof ConstantNode) {
return $key
->getConstantName() != 'LANGUAGE_NONE';
}
elseif ($key instanceof StringNode) {
return $key
->toValue() != 'und';
}
else {
return TRUE;
}
}