Skip to content

Commit

Permalink
Ticket #4407 - Custom cover title.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Jul 24, 2023
1 parent e1d947e commit 547ab02
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
1 change: 1 addition & 0 deletions install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5531,6 +5531,7 @@ CREATE TABLE IF NOT EXISTS `sys_objects_page` (
`module` varchar(32) NOT NULL,
`cover` tinyint(4) NOT NULL DEFAULT '1',
`cover_image` int(11) NOT NULL DEFAULT '0',
`cover_title` varchar(255) NOT NULL DEFAULT '',
`type_id` int(11) NOT NULL DEFAULT '1',
`layout_id` int(11) NOT NULL,
`sticky_columns` tinyint(4) NOT NULL DEFAULT '0',
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
<string name="_adm_bp_txt_page_cache_lifetime"><![CDATA[Cache]]></string>
<string name="_adm_bp_txt_page_cover"><![CDATA[Cover]]></string>
<string name="_adm_bp_txt_page_cover_image"><![CDATA[Custom Cover]]></string>
<string name="_adm_bp_txt_page_cover_title"><![CDATA[Custom Title]]></string>
<string name="_adm_bp_txt_page_cover_0"><![CDATA[Disabled]]></string>
<string name="_adm_bp_txt_page_cover_1"><![CDATA[Enabled for all]]></string>
<string name="_adm_bp_txt_page_cover_2"><![CDATA[Enabled for visitors only]]></string>
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
<string name="_adm_bp_txt_page_cache_lifetime"><![CDATA[Кэш]]></string>
<string name="_adm_bp_txt_page_cover"><![CDATA[Обложка]]></string>
<string name="_adm_bp_txt_page_cover_image"><![CDATA[Собственная обложка]]></string>
<string name="_adm_bp_txt_page_cover_title"><![CDATA[Собственный заголовок]]></string>
<string name="_adm_bp_txt_page_cover_0"><![CDATA[Отключен]]></string>
<string name="_adm_bp_txt_page_cover_1"><![CDATA[Включен для всех]]></string>
<string name="_adm_bp_txt_page_cover_2"><![CDATA[Включен только для гостей]]></string>
Expand Down
1 change: 1 addition & 0 deletions studio/classes/BxDolStudioBuilderPageQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function getPages($aParams)
`tp`.`module` AS `module`,
`tp`.`cover` AS `cover`,
`tp`.`cover_image` AS `cover_image`,
`tp`.`cover_title` AS `cover_title`,
`tp`.`type_id` AS `type_id`,
`tp`.`layout_id` AS `layout_id`,
`tp`.`submenu` AS `submenu`,
Expand Down
12 changes: 11 additions & 1 deletion studio/template/scripts/BxBaseStudioBuilderPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,17 @@ protected function getSettingsCover($aPage = array(), $bCreate = true, $bInputsO
'db' => array (
'pass' => 'Int',
)
)
),
'cover_title' => array(
'type' => 'text_translatable',
'name' => 'cover_title',
'caption' => _t('_adm_bp_txt_page_cover_title'),
'info' => '',
'value' => isset($aPage['cover_title']) ? $aPage['cover_title'] : '',
'db' => array (
'pass' => 'Xss',
)
),
)
);

Expand Down
37 changes: 22 additions & 15 deletions template/scripts/BxBasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,25 +329,32 @@ public function getPageCoverImage($bTranscoder = true)

public function getPageCoverParams()
{
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if($oMenuSubmenu) {
$aParams = $oMenuSubmenu->getPageCoverParams();
if(!empty($aParams) && is_array($aParams))
return $aParams;
}

return array (
$aParams = [
'title' => $this->_getPageTitle(),
'actions' => '',
'bx_if:image' => array (
'bx_if:image' => [
'condition' => false,
'content' => array(),
),
'bx_if:icon' => array (
'content' => []
],
'bx_if:icon' => [
'condition' => false,
'content' => array(),
),
);
'content' => []
],
];

if(($oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu')) !== false) {
$aCoverParams = $oMenuSubmenu->getPageCoverParams();
if(!empty($aCoverParams) && is_array($aCoverParams))
$aParams = $aCoverParams;
}

if(!empty($this->_aObject['cover_title'])) {
$sCoverTitle = _t($this->_aObject['cover_title']);
if($sCoverTitle && strcmp($sCoverTitle, $this->_aObject['cover_title']) != 0)
$aParams['title'] = $sCoverTitle;
}

return $aParams;
}

/**
Expand Down

0 comments on commit 547ab02

Please sign in to comment.