| @@ 83-98 (lines=16) @@ | ||
| 80 | * |
|
| 81 | * @return integer $count |
|
| 82 | */ |
|
| 83 | public function getCount() |
|
| 84 | { |
|
| 85 | /**@var integer $count quantity images in additional field gallery*/ |
|
| 86 | $count = 0; |
|
| 87 | ||
| 88 | if ($this->hasImages()) { |
|
| 89 | // Getting quantity images for gallery |
|
| 90 | $count = $this->query |
|
| 91 | ->entity(CMS::MATERIAL_IMAGES_RELATION_ENTITY) |
|
| 92 | ->cond(Field::F_DELETION, 1) |
|
| 93 | ->cond(MaterialField::F_PRIMARY, $this->materialFieldId) |
|
| 94 | ->count(); |
|
| 95 | } |
|
| 96 | ||
| 97 | return $count; |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Get collection of images for material by gallery additional field selector. If none is passed |
|
| @@ 80-95 (lines=16) @@ | ||
| 77 | * |
|
| 78 | * @return array |
|
| 79 | */ |
|
| 80 | public function getImages() |
|
| 81 | { |
|
| 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 | } |
|
| 96 | } |
|