| @@ 185-204 (lines=20) @@ | ||
| 182 | * @param FilterResponseEvent $event |
|
| 183 | * Response event. |
|
| 184 | */ |
|
| 185 | public function propagateSelection(FilterResponseEvent $event) { |
|
| 186 | $render = [ |
|
| 187 | 'labels' => [ |
|
| 188 | '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 189 | return $item->label(); |
|
| 190 | }, $this->entities)), |
|
| 191 | '#attached' => [ |
|
| 192 | 'library' => ['entity_browser/iframe_selection'], |
|
| 193 | 'drupalSettings' => [ |
|
| 194 | 'entity_browser' => [ |
|
| 195 | 'iframe' => [ |
|
| 196 | 'entities' => array_map(function (EntityInterface $item) { |
|
| 197 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
|
| 198 | }, $this->entities), |
|
| 199 | 'uuid' => $this->request->query->get('uuid'), |
|
| 200 | ], |
|
| 201 | ], |
|
| 202 | ], |
|
| 203 | ], |
|
| 204 | ], |
|
| 205 | ]; |
|
| 206 | ||
| 207 | $event->setResponse(new Response(\Drupal::service('bare_html_page_renderer')->renderBarePage($render, 'Entity browser', 'page'))); |
|
| @@ 240-259 (lines=20) @@ | ||
| 237 | * @param FilterResponseEvent $event |
|
| 238 | * Response event. |
|
| 239 | */ |
|
| 240 | public function propagateSelection(FilterResponseEvent $event) { |
|
| 241 | $render = [ |
|
| 242 | 'labels' => [ |
|
| 243 | '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 244 | return $item->label(); |
|
| 245 | }, $this->entities)), |
|
| 246 | '#attached' => [ |
|
| 247 | 'library' => ['entity_browser/modal_selection'], |
|
| 248 | 'drupalSettings' => [ |
|
| 249 | 'entity_browser' => [ |
|
| 250 | 'modal' => [ |
|
| 251 | 'entities' => array_map(function (EntityInterface $item) { |
|
| 252 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
|
| 253 | }, $this->entities), |
|
| 254 | 'uuid' => $this->request->query->get('uuid'), |
|
| 255 | ], |
|
| 256 | ], |
|
| 257 | ], |
|
| 258 | ], |
|
| 259 | ], |
|
| 260 | ]; |
|
| 261 | ||
| 262 | $event->setResponse(new Response(\Drupal::service('bare_html_page_renderer')->renderBarePage($render, 'Entity browser', 'page'))); |
|