| Conditions | 5 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function validate($value, Constraint $constraint) { |
||
| 17 | if (!isset($value)) { |
||
| 18 | return; |
||
| 19 | } |
||
| 20 | if ($value->hasField($constraint->sourceFieldName)) { |
||
| 21 | $slideshowItems = $value->get($constraint->sourceFieldName); |
||
| 22 | foreach ($slideshowItems as $item) { |
||
| 23 | $itemBundle = \Drupal::entityTypeManager()->getStorage('media')->load($item->target_id)->bundle(); |
||
| 24 | if ($itemBundle == "gallery") { |
||
| 25 | $this->context->addViolation($constraint->message); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 32 |