You are here

public function EntityExtraField::setBuildAttachment in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/EntityExtraField.php \Drupal\entity_extra_field\Entity\EntityExtraField::setBuildAttachment()

Set a build attachment.

Parameters

$type: The type of attachment (library, drupalSettings, etc)

array $attachment: An array of attachment settings for the particular type.

Return value

$this

Overrides EntityExtraFieldInterface::setBuildAttachment

File

src/Entity/EntityExtraField.php, line 258

Class

EntityExtraField
Define entity extra field.

Namespace

Drupal\entity_extra_field\Entity

Code

public function setBuildAttachment($type, array $attachment) {
  if (!isset($this->build_attachments[$type])) {
    $this->build_attachments[$type] = [];
  }
  $this->build_attachments[$type] = array_replace_recursive($this->build_attachments[$type], $attachment);
  return $this;
}