You are here

public static function EntityBrowserBlock::processEntityBrowser in Entity Browser Block 8

Render API callback: Processes the entity browser element.

File

src/Plugin/Block/EntityBrowserBlock.php, line 249

Class

EntityBrowserBlock
Defines a generic entity browser block type.

Namespace

Drupal\entity_browser_block\Plugin\Block

Code

public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) {
  $element['entity_ids']['#ajax'] = [
    'callback' => [
      self::class,
      'updateCallback',
    ],
    'wrapper' => 'entity-browser-block-form',
    'event' => 'entity_browser_value_updated',
  ];
  $element['entity_ids']['#default_value'] = implode(' ', array_keys($element['#default_value']));
  return $element;
}