_pageHeaderTemplates['headerList'] = 'Manage %itemsName% in "%albumTitle%" Album'; return parent::_init(); } public function exec() { $this->_initApplication(); return parent::exec(); } protected function _initApplication() { $params = $this->getRestParams(); if (1 == count($params) && ($galleryId = $params[0])) { $this->_getDataObj()->setGalleryId($galleryId); if (null === ($title = $this->_getDataObj()->getGallery('title'))) { $this->_do404(); } $this->setMessagePlaceholder('albumTitle', $title); } else { $this->_do404(); } return $this; } protected function _doList() { if (('y' !== $this->_getDataObj()->getGallery('enabled'))) { $this->_addHiddenAlbumNote(); } return parent::_doList(); } protected function _addHiddenAlbumNote() { $item = ['tpl' => $this->getTemplate('hidden-album-note.tpl')]; $this->_addItem($item); return $this; } protected function _getNewForm(array $options = []) { $form = parent::_getNewForm($options); $this->_setFormAlbumTitle($form); return $form; } protected function _getEditForm(array $options = []) { $form = parent::_getEditForm($options); $this->_setFormAlbumTitle($form); return $form; } protected function _setFormAlbumTitle(Qs_Form $form) { $form->setDefault('albumTitle', $this->getConfig('albumTitle')); return $this; } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); if (($url = GalleryView::getPageUrl())) { $links[] = ['title' => 'Manage Albums', 'url' => $url]; } return $links; } public static function getPageUrl() { static $url; if (null === $url) { $url = Qs_SiteMap::findFirst(null, ['type' => Qs_SiteMap::classToType(get_called_class())], null, 'url'); } return $url; } protected function _getFormOptions($type = null) { $options = parent::_getFormOptions($type); $options['galleryId'] = $this->_getDataObj()->getGalleryId(); return $options; } }