You are here

protected function MiconViewBuilder::getBuildDefaults in Micon 8

Same name and namespace in other branches
  1. 2.x src/MiconViewBuilder.php \Drupal\micon\MiconViewBuilder::getBuildDefaults()

Provides entity-specific defaults to the build process.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which the defaults should be provided.

string $view_mode: The view mode that should be used.

Return value

array

Overrides EntityViewBuilder::getBuildDefaults

File

src/MiconViewBuilder.php, line 18

Class

MiconViewBuilder
Base class for entity view builders.

Namespace

Drupal\micon

Code

protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
  $build = parent::getBuildDefaults($entity, $view_mode);

  // Use micon_package as the #theme for clarity.
  $build['#theme'] .= '_package';
  $build['#attached']['library'][] = 'micon/micon.' . $entity
    ->id();
  return $build;
}