public function FieldValueFilter::__invoke in Drupal 7 to 8/9 Module Upgrader 8
Return value
bool
File
- src/
Utility/ Filter/ FieldValueFilter.php, line 30
Class
- FieldValueFilter
- Filters for things that *look like* field accesses, e.g. $foo->bar[LANGUAGE_NONE][0]['value']. This filter doesn't guarantee that matched nodes actually ARE field accesses -- just that they have the proper formation (S-foils in…
Namespace
Drupal\drupalmoduleupgrader\Utility\FilterCode
public function __invoke(Node $node) {
if ($node instanceof ArrayLookupNode) {
$root = $node
->getRootArray();
if ($root instanceof ObjectPropertyNode) {
$object = $root
->getObject();
if ($object instanceof VariableNode && $object
->getName() == $this->variable) {
return sizeof($node
->getKeys()) >= 3;
}
}
}
return FALSE;
}