public function LayoutBuilderFieldDependencyCollector::fieldCondition in Dependency Calculation 8
Determines if the field is of one of the specified types.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
string $field_name: The field name.
\Drupal\Core\Field\FieldItemListInterface $field: The field.
Return value
bool Whether the field type is one of the specified ones.
File
- src/
EventSubscriber/ DependencyCollector/ LayoutBuilderFieldDependencyCollector.php, line 65
Class
- LayoutBuilderFieldDependencyCollector
- Subscribes to dependency collection to extract entities referenced on Layout Builder components.
Namespace
Drupal\depcalc\EventSubscriber\DependencyCollectorCode
public function fieldCondition(ContentEntityInterface $entity, $field_name, FieldItemListInterface $field) {
return in_array($field
->getFieldDefinition()
->getType(), [
'layout_section',
]);
}