You are here

public function EntityBrowser::addWidget in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Entity/EntityBrowser.php \Drupal\entity_browser\Entity\EntityBrowser::addWidget()

Saves a widget for this entity browser.

Parameters

array $configuration: An array of widget configuration.

Return value

string The widget ID.

Overrides EntityBrowserInterface::addWidget

File

src/Entity/EntityBrowser.php, line 289

Class

EntityBrowser
Defines an entity browser configuration entity.

Namespace

Drupal\entity_browser\Entity

Code

public function addWidget(array $configuration) {
  $configuration['uuid'] = $this
    ->uuidGenerator()
    ->generate();
  $this
    ->getWidgets()
    ->addInstanceId($configuration['uuid'], $configuration);
  return $configuration['uuid'];
}