Commit 7041279c authored by webchick's avatar webchick

Issue #2314359 by yched: Optimization: do not iterate on fields in EntityViewBuilder::viewField().

parent 0b0cdc29
......@@ -394,7 +394,8 @@ public function viewField(FieldItemListInterface $items, $display_options = arra
if (is_string($display_options)) {
$view_mode = $display_options;
$display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
foreach ($entity as $name => $items) {
// Hide all fields except the current one.
foreach (array_keys($entity->getFieldDefinitions()) as $name) {
if ($name != $field_name) {
$display->removeComponent($name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment