You are here

public function DisplayHelper::getNewComponents in Lightning Core 8.4

Same name and namespace in other branches
  1. 8.5 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewComponents()
  2. 8 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewComponents()
  3. 8.2 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewComponents()
  4. 8.3 src/DisplayHelper.php \Drupal\lightning_core\DisplayHelper::getNewComponents()

Returns the components newly added to a display.

Parameters

\Drupal\Core\Entity\Display\EntityDisplayInterface $display: The display config entity.

Return value

array The newly added components.

1 call to DisplayHelper::getNewComponents()
DisplayHelper::getNewFields in src/DisplayHelper.php
Returns newly added field components, optionally filtered by a function.

File

src/DisplayHelper.php, line 78

Class

DisplayHelper
Helps query and configure various display settings.

Namespace

Drupal\lightning_core

Code

public function getNewComponents(EntityDisplayInterface $display) {
  if (isset($display->original)) {
    return array_diff_key($display
      ->getComponents(), $display->original
      ->getComponents());
  }
  else {
    return [];
  }
}