| @@ 182-201 (lines=20) @@ | ||
| 179 | * @param FilterResponseEvent $event |
|
| 180 | * Response event. |
|
| 181 | */ |
|
| 182 | public function propagateSelection(FilterResponseEvent $event) { |
|
| 183 | $render = [ |
|
| 184 | 'labels' => [ |
|
| 185 | '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 186 | return $item->label(); |
|
| 187 | }, $this->entities)), |
|
| 188 | '#attached' => [ |
|
| 189 | 'library' => ['entity_browser/iframe_selection'], |
|
| 190 | 'drupalSettings' => [ |
|
| 191 | 'entity_browser' => [ |
|
| 192 | 'iframe' => [ |
|
| 193 | 'entities' => array_map(function (EntityInterface $item) { |
|
| 194 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
|
| 195 | }, $this->entities), |
|
| 196 | 'uuid' => $this->request->query->get('uuid'), |
|
| 197 | ], |
|
| 198 | ], |
|
| 199 | ], |
|
| 200 | ], |
|
| 201 | ], |
|
| 202 | ]; |
|
| 203 | ||
| 204 | $event->setResponse(new Response(\Drupal::service('bare_html_page_renderer')->renderBarePage($render, 'Entity browser', 'page'))); |
|
| @@ 305-324 (lines=20) @@ | ||
| 302 | * @param FilterResponseEvent $event |
|
| 303 | * Response event. |
|
| 304 | */ |
|
| 305 | public function propagateSelection(FilterResponseEvent $event) { |
|
| 306 | $render = [ |
|
| 307 | 'labels' => [ |
|
| 308 | '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 309 | return $item->label(); |
|
| 310 | }, $this->entities)), |
|
| 311 | '#attached' => [ |
|
| 312 | 'library' => ['entity_browser/modal_selection'], |
|
| 313 | 'drupalSettings' => [ |
|
| 314 | 'entity_browser' => [ |
|
| 315 | 'modal' => [ |
|
| 316 | 'entities' => array_map(function (EntityInterface $item) { |
|
| 317 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
|
| 318 | }, $this->entities), |
|
| 319 | 'uuid' => $this->request->query->get('uuid'), |
|
| 320 | ], |
|
| 321 | ], |
|
| 322 | ], |
|
| 323 | ], |
|
| 324 | ], |
|
| 325 | ]; |
|
| 326 | ||
| 327 | $event->setResponse(new Response(\Drupal::service('bare_html_page_renderer')->renderBarePage($render, 'Entity browser', 'page'))); |
|