| Conditions | 5 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function viewElements(FieldItemListInterface $items, $langcode) { |
||
| 32 | $element = array(); |
||
| 33 | |||
| 34 | foreach ($items as $delta => $item) { |
||
| 35 | if ($url = $item->getUrl()->toString()) { |
||
| 36 | try { |
||
| 37 | if ($info = $this->urlEmbed()->getEmbed($url)) { |
||
| 38 | $element[$delta] = array( |
||
| 39 | '#type' => 'inline_template', |
||
| 40 | '#template' => $info->getCode(), |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | catch (\Exception $exception) { |
||
| 45 | watchdog_exception('url_embed', $exception); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | return $element; |
||
| 51 | } |
||
| 52 | |||
| 54 |