Get Gallery Options

Get all gallery media categories
@param  void
@return mixed Array | null
484313
public function getGalleries()
    {
        if ($this->galleries) {
            return $this->galleries;
        }

        $mediaCategoryMapper = ($this->container->dataMapper)('MediaCategoryMapper');

        return $this->galleries = $mediaCategoryMapper->findCategories();
    }
310113
public function getMediaUrls()
    {
        if ($this->_aMediaUrls === null) {
            $this->_aMediaUrls = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_aMediaUrls->init("oxmediaurl");
            $this->_aMediaUrls->getBaseObject()->setLanguage($this->getLanguage());

            $sViewName = getViewName("oxmediaurls", $this->getLanguage());
            $sQ = "select * from {$sViewName} where oxobjectid = '" . $this->getId() . "'";
            $this->_aMediaUrls->selectString($sQ);
        }

        return $this->_aMediaUrls;
    }
907964
public function getCategories()
    {
        if (null === $this->_categories) {

            $collection = Mage::getModel('catalog/category')->getCollection();

            $pathLike = Mage_Catalog_Model_Category::TREE_ROOT_ID . '/' . Mage::app()->getStore()->getRootCategoryId() . '/%';
            $collection
                ->initCache(Mage::app()->getCacheInstance(), self::class, [Mage_Catalog_Model_Category::CACHE_TAG])
                ->setStoreId(Mage::app()->getStore()->getId())
                ->addAttributeToSelect('*')
                ->addFieldToFilter('path', [
                    'like' => $pathLike,
                ])
                ->addIsActiveFilter()
                ->addAttributeToFilter('include_in_menu', 1)
                ->joinUrlRewrite();

            // Sort
            $collection->getSelect()->reset(Zend_Db_Select::ORDER);
            $collection
                ->addOrder('position', Varien_Data_Collection_Db::SORT_ORDER_ASC);

            foreach ($collection as $id => $category) {
                $this->_categories[$id] = $category;
            }
        }

        return $this->_categories;
    }
221649
public function getCategory($key)
    {
        return array_key_exists($key, $this->_categories) ? $this->_categories[$key] : null;
    }
679780
public function firstImageFile(): ?MediaFile
    {
        foreach ($this->mediaFiles() as $media_file) {
            if ($media_file->isImage()) {
                return $media_file;
            }
        }

        return null;
    }
1274535
public function getActCategory()
    {
        $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);

        return ($oCat->load($this->getActCatId())) ? $oCat : null;
    }
785520
public function toArray($skip_empty = false, $include_original = true)
    {
        // Skip when no media
        if ($skip_empty === true && $this->hasMedia() === false) {
            return null;
        }

        $urls = [];

        foreach ($this->styles as $name => $style) {
            if ($include_original === false
                && $this->config('default_style') === $name
            ) {
                continue;
            }

            $urls[$name] = $this->url($name);
        }

        return $urls;
    }
1287386
protected function getDisplayOptions()
    {
        $displayOptions = array();
        $dumperOptions = $this->getDumperOptions();
        // Only used by Symfony 3.2 and newer:
        if (isset($dumperOptions['expanded_depth'])) {
            $displayOptions['maxDepth'] = $dumperOptions['expanded_depth'];
        }
        // Only used by Symfony 3.2 and newer:
        if (isset($dumperOptions['max_string'])) {
            $displayOptions['maxStringLength'] = $dumperOptions['max_string'];
        }
        // Only used by Symfony 3.2 and newer:
        if (isset($dumperOptions['file_link_format'])) {
            $displayOptions['fileLinkFormat'] = $dumperOptions['file_link_format'];
        }
        return $displayOptions;
    }
1276871
public function photos()
    {
        $links[] = [__d('me_cms', 'List photos'), [
            'controller' => 'Photos',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Upload photos'), [
            'controller' => 'Photos',
            'action' => 'upload',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'List albums'), [
            'controller' => 'PhotosAlbums',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Add album'), [
            'controller' => 'PhotosAlbums',
            'action' => 'add',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        return [$links, I18N_PHOTOS, ['icon' => 'camera-retro']];
    }
799582
public function getMedia()
    {
        $mediaMapper = ($this->container->dataMapper)('MediaMapper');

        $data = $mediaMapper->find();

        $template = <<<HTML
            {% import "@admin/media/_mediaCardMacro.html" as file %}
            <div class="card-wrapper">
            {% for media in page.media %}
              {{ file.mediaCard(media) }}
            {% endfor %}
            </div>
HTML;

        $mediaHtml = $this->container->view->fetchFromString($template, ['page' => ['media' => $data]]);

        $response = $this->response->withHeader('Content-Type', 'application/json');

        return $response->write(json_encode(["html" => $mediaHtml]));
    }
581936
public function getImageTitleOptions()
    {
        return [
            self::IMAGE_TITLE_NONE => _t(__CLASS__ . '.NONE', 'None'),
            self::IMAGE_TITLE_MEDIA => _t(__CLASS__ . '.MEDIATITLE', 'Media Title'),
            self::IMAGE_TITLE_COMPONENT => _t(__CLASS__ . '.COMPONENTTITLE', 'Component Title')
        ];
    }
1307331
public function getCategories($context = null)
    {
        $context = $this->getContext($context);

        $this->loadCategories($context);

        return $this->categories[$context->getId()];
    }
497915
public function getExposedsByClass()
    {
        $id = $this->getRequestParameter('id');

        if (is_null($id) || empty($id)) {
            return $this->returnBadParameter('The class URI is required');
        }

        $class = $this->getClass($id);

        $service = $this->getServiceLocator()->get(CategoryService::SERVICE_ID);

        $data = [];
        $properties = $service->getElligibleProperties($class);
        foreach ($properties as $property) {
            $data[$property->getUri()] = $service->doesExposeCategory($property);
        }

        return $this->returnSuccess($data);
    }
540270
public function getCategory()
    {
        $categoryModel = static::getCategoryModel();
        return ($this->type == self::TYPE_CATEGORY) ? $this->hasOne($categoryModel::className(), ['id' => $this->options->category_id]) : null;
    }
71211
public static function getList()
    {
        $app = Application::getFacadeApplication();
        $em = $app->make(EntityManagerInterface::class);

        return $em->getRepository(ThumbnailTypeEntity::class)->findBy([], ['ftTypeWidth' => 'asc']);
    }
922173
public function onCategoriesOptionsCallback()
    {
        /** @var Input $input */
        $input = $this->framework->getAdapter(Input::class);

        // Do not generate the options for other views than listings
        if ($input->get('act') && $input->get('act') !== 'select') {
            return [];
        }

        return $this->generateOptionsRecursively();
    }
1084098
private function getImageFiles()
    {
        if ($this->imageFiles === null) {
            // Get a list of images.
            $this->imageFiles = $this->filesystem
                ->find()
                ->in('files://')
                ->name('/\.jpe?g$/')
                ->name('*.png')
                ->toArray()
            ;
        }

        return $this->imageFiles;
    }