| @@ 61-70 (lines=10) @@ | ||
| 58 | **/ |
|
| 59 | public function hasImages() |
|
| 60 | { |
|
| 61 | if (isset($this->materialFieldId)) { |
|
| 62 | // Getting quantity images, if quantity more 0 then material has images |
|
| 63 | if ($this->query |
|
| 64 | ->entity(CMS::MATERIAL_IMAGES_RELATION_ENTITY) |
|
| 65 | ->cond(Field::F_DELETION, 1) |
|
| 66 | ->where(MaterialField::F_PRIMARY, $this->materialFieldId) |
|
| 67 | ->count() > 0) { |
|
| 68 | return true; |
|
| 69 | } |
|
| 70 | } |
|
| 71 | return false; |
|
| 72 | } |
|
| 73 | ||
| @@ 85-92 (lines=8) @@ | ||
| 82 | /** @var $images[] Get material images for this gallery */ |
|
| 83 | $images = array(); |
|
| 84 | ||
| 85 | if ($this->hasImages()) { |
|
| 86 | //Get All images for materialFieldId |
|
| 87 | $images = $this->query |
|
| 88 | ->entity(CMS::MATERIAL_IMAGES_RELATION_ENTITY) |
|
| 89 | ->cond(Field::F_DELETION, 1) |
|
| 90 | ->where(MaterialField::F_PRIMARY, $this->materialFieldId) |
|
| 91 | ->exec(); |
|
| 92 | } |
|
| 93 | ||
| 94 | return $images; |
|
| 95 | } |
|