public function DisplayHelper::getNewFields in Lightning Core 8.3
Same name and namespace in other branches
- 8.5 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewFields()
- 8 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewFields()
- 8.2 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewFields()
- 8.4 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewFields()
Returns newly added field components, optionally filtered by a function.
Parameters
\Drupal\Core\Entity\Display\EntityDisplayInterface $display: The display config entity.
callable|NULL $filter: (optional) The function on which to filter the fields, accepting the field storage definition as an argument.
Return value
array The newly added components.
File
- src/
DisplayHelper.php, line 99
Class
- DisplayHelper
- Helps query and configure various display settings.
Namespace
Drupal\lightning_coreCode
public function getNewFields(EntityDisplayInterface $display, callable $filter = NULL) {
$fields = $this->entityFieldManager
->getFieldStorageDefinitions($display
->getTargetEntityTypeId());
if ($filter) {
$fields = array_filter($fields, $filter);
}
return array_intersect_key($this
->getNewComponents($display), $fields);
}