Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ protected function _prepareForm()
]);

// Setting custom renderer for content field to remove label column
/** @var Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element $renderer */
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')
->setTemplate('cms/page/edit/form/renderer/content.phtml');
$contentField->setRenderer($renderer);
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ public function getItemRenderer($type)
}

if (is_null($this->_itemRenders[$type]['renderer'])) {
$this->_itemRenders[$type]['renderer'] = $this->getLayout()
/** @var Mage_Adminhtml_Block_Sales_Items_Abstract $renderer */
$renderer = $this->getLayout()
->createBlock($this->_itemRenders[$type]['block'])
->setTemplate($this->_itemRenders[$type]['template']);
$this->_itemRenders[$type]['renderer'] = $renderer;
foreach ($this->_columnRenders as $columnType => $renderer) {
$this->_itemRenders[$type]['renderer']->addColumnRender($columnType, $renderer['block'], $renderer['template']);
}
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public function _construct()
/**
* Prepare block layout
*
* @return Mage_Core_Block_Abstract
* @return Mage_Adminhtml_Block_Template
*/
protected function _prepareLayout()
{
$this->_cellTemplate = $this->getLayout()
->createBlock('adminhtml/template')
->setTemplate('system/store/cell.phtml');
/** @var Mage_Adminhtml_Block_Template $block */
$block = $this->getLayout()->createBlock('adminhtml/template');
$this->_cellTemplate = $block->setTemplate('system/store/cell.phtml');
return parent::_prepareLayout();
}

Expand Down
10 changes: 6 additions & 4 deletions app/code/core/Mage/Adminhtml/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Mage_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
protected function _outTemplate($tplName, $data = [])
{
$this->_initLayoutMessages('adminhtml/session');
$block = $this->getLayout()->createBlock('adminhtml/template')->setTemplate("$tplName.phtml");
/** @var Mage_Adminhtml_Block_Template $block */
$block = $this->getLayout()->createBlock('adminhtml/template');
$block->setTemplate("$tplName.phtml");
foreach ($data as $index => $value) {
$block->assign($index, $value);
}
Expand Down Expand Up @@ -131,9 +133,9 @@ public function globalSearchAction()
$totalCount = count($items);
}

$block = $this->getLayout()->createBlock('adminhtml/template')
->setTemplate('system/autocomplete.phtml')
->assign('items', $items);
/** @var Mage_Adminhtml_Block_Template $block */
$block = $this->getLayout()->createBlock('adminhtml/template');
$block->setTemplate('system/autocomplete.phtml')->assign('items', $items);

$this->getResponse()->setBody($block->toHtml());
}
Expand Down
68 changes: 68 additions & 0 deletions app/code/core/Mage/Cms/Api/Data/BlockInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

interface Mage_Cms_Api_Data_BlockInterface
{
public const DATA_ID = 'block_id';

public const DATA_CONTENT = 'content';

public const DATA_CREATION_TIME = 'creation_time';

public const DATA_IDENTIFIER = 'identifier';

public const DATA_IS_ACTIVE = 'is_active';

public const DATA_STORE_ID = 'store_id';

public const DATA_TITLE = 'title';

public const DATA_UPDATE_TIME = 'update_time';

public function getBlockId(): ?int;

public function setBlockId(?int $blockId);

public function getTitle(): string;

public function setTitle(string $title);

public function getIdentifier(): string;

public function setIdentifier(string $identifier);

public function getContent(): ?string;

public function setContent(?string $content);

public function getCreationTime(): ?string;

public function setCreationTime(?string $time);

public function getUpdateTime(): ?string;

public function setUpdateTime(?string $time);

public function getIsActive(): int;

public function setIsActive(int $value);

public function getStoreId(): ?int;

public function setStoreId(int $storeId);
}
134 changes: 134 additions & 0 deletions app/code/core/Mage/Cms/Api/Data/PageInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

interface Mage_Cms_Api_Data_PageInterface
{
public const DATA_ID = 'page_id';

public const DATA_CONTENT = 'content';

public const DATA_CONTENT_HEADING = 'content_heading';

public const DATA_CREATION_TIME = 'creation_time';

public const DATA_CUSTOM_LAYOUT_UPDATE_XML = 'custom_layout_update_xml';

public const DATA_CUSTOM_ROOT_TEMPLATE = 'custom_root_template';

public const DATA_CUSTOM_THEME = 'custom_theme';

public const DATA_CUSTOM_THEME_FROM = 'custom_theme_from';

public const DATA_CUSTOM_THEME_TO = 'custom_theme_to';

public const DATA_IDENTIFIER = 'identifier';

public const DATA_IS_ACTIVE = 'is_active';

public const DATA_LAYOUT_UPDATE_XML = 'layout_update_xml';

public const DATA_META_DESCRIPTION = 'meta_description';

public const DATA_META_KEYWORDS = 'meta_keywords';

public const DATA_ROOT_TEMPLATE = 'root_template';

public const DATA_SORT_ORDER = 'sort_order';

public const DATA_STORE_ID = 'store_id';

public const DATA_TITLE = 'title';

public const DATA_UPDATE_TIME = 'update_time';

public function getPageId(): ?int;

public function setPageId(?int $pageId);

public function getTitle(): ?string;

public function setTitle(?string $title);

public function getRootTemplate(): ?string;

public function setRootTemplate(?string $template);

public function getMetaKeywords(): ?string;

public function setMetaKeywords(?string $keywords);

public function getMetaDescription(): ?string;

public function setMetaDescription(?string $description);

public function getIdentifier(): ?string;

public function setIdentifier(?string $identifier);

public function getContentHeading(): ?string;

public function setContentHeading(?string $content);

public function getContent(): ?string;

public function setContent(?string $content);

public function getCreationTime(): ?string;

public function setCreationTime(?string $value);

public function getUpdateTime(): ?string;

public function setUpdateTime(?string $time);

public function getIsActive(): int;

public function setIsActive(int $value);

public function getSortOrder(): int;

public function setSortOrder(int $position);

public function getLayoutUpdateXml(): ?string;

public function setLayoutUpdateXml(?string $xml);

public function getCustomTheme(): ?string;

public function setCustomTheme(?string $from);

public function getCustomRootTemplate(): ?string;

public function setCustomRootTemplate(?string $template);

public function getCustomLayoutUpdateXml(): ?string;

public function setCustomLayoutUpdateXml(?string $xml);

public function getCustomThemeTo(): ?string;

public function setCustomThemeTo(?string $to);

public function getCustomThemeFrom(): ?string;

public function setCustomThemeFrom(?string $from);

public function getStoreId(): ?int;

public function setStoreId(int $storeId);
}
36 changes: 21 additions & 15 deletions app/code/core/Mage/Cms/Block/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* Cms page content block
*
* @package Mage_Cms
*
* @method int getPageId()
*/
class Mage_Cms_Block_Page extends Mage_Core_Block_Abstract
{
Expand All @@ -25,10 +23,11 @@ class Mage_Cms_Block_Page extends Mage_Core_Block_Abstract
public function getPage()
{
if (!$this->hasData('page')) {
if ($this->getPageId()) {
$pageId = $this->getPageId();
if ($pageId) {
$page = Mage::getModel('cms/page')
->setStoreId(Mage::app()->getStore()->getId())
->load($this->getPageId(), 'identifier');
->load($pageId, 'identifier');
} else {
$page = Mage::getSingleton('cms/page');
}
Expand All @@ -37,7 +36,12 @@ public function getPage()
$this->setData('page', $page);
}

return $this->getData('page');
return $this->getDataByKey('page');
}

public function getPageId(): ?string
{
return $this->getDataByKey('page_id');
}

/**
Expand All @@ -46,15 +50,17 @@ public function getPage()
*/
protected function _prepareLayout()
{
$page = $this->getPage();
$page = $this->getPage();
$pageTitle = $page->getTitle();
$identifier = $page->getIdentifier();

$breadcrumbsArray = [];
$breadcrumbs = null;

// show breadcrumbs
if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs')
&& ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))
&& ($page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_home_page'))
&& ($page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_no_route'))
&& ($identifier !== Mage::getStoreConfig('web/default/cms_home_page'))
&& ($identifier !== Mage::getStoreConfig('web/default/cms_no_route'))
) {
$breadcrumbsArray[] = [
'crumbName' => 'home',
Expand All @@ -67,17 +73,17 @@ protected function _prepareLayout()
$breadcrumbsArray[] = [
'crumbName' => 'cms_page',
'crumbInfo' => [
'label' => $page->getTitle(),
'title' => $page->getTitle(),
'label' => $pageTitle,
'title' => $pageTitle,
],
];
$breadcrumbsObject = new Varien_Object();
$breadcrumbsObject->setCrumbs($breadcrumbsArray);
$breadcrumbsObject->setData('crumbs', $breadcrumbsArray);

Mage::dispatchEvent('cms_generate_breadcrumbs', ['breadcrumbs' => $breadcrumbsObject]);

if ($breadcrumbs instanceof Mage_Page_Block_Html_Breadcrumbs) {
foreach ($breadcrumbsObject->getCrumbs() as $breadcrumbsItem) {
foreach ($breadcrumbsObject->getDataByKey('crumbs') as $breadcrumbsItem) {
$breadcrumbs->addCrumb($breadcrumbsItem['crumbName'], $breadcrumbsItem['crumbInfo']);
}
}
Expand All @@ -86,13 +92,13 @@ protected function _prepareLayout()
/** @var Mage_Page_Block_Html $root */
$root = $this->getLayout()->getBlock('root');
if ($root) {
$root->addBodyClass('cms-' . $page->getIdentifier());
$root->addBodyClass('cms-' . $identifier);
}

/** @var Mage_Page_Block_Html_Head $head */
$head = $this->getLayout()->getBlock('head');
if ($head) {
$head->setTitle($page->getTitle());
$head->setTitle($pageTitle);
$head->setKeywords($page->getMetaKeywords());
$head->setDescription($page->getMetaDescription());

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Block/Widget/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function _construct()
protected function _beforeToHtml()
{
parent::_beforeToHtml();
$blockId = $this->getData('block_id');
$blockId = $this->getDataByKey('block_id');
$blockHash = static::class . $blockId;

if (isset(self::$_widgetUsageMap[$blockHash])) {
Expand Down
Loading
Loading