Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Core - DOC block update #702

Merged
merged 7 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 42 additions & 36 deletions app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object
/**
* Contains references to child block objects
*
* @var array
* @var Mage_Core_Block_Abstract[]
*/
protected $_children = array();

Expand Down Expand Up @@ -255,7 +255,7 @@ public function getRequest()
/**
* Retrieve parent block
*
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function getParentBlock()
{
Expand All @@ -266,7 +266,7 @@ public function getParentBlock()
* Set parent block
*
* @param Mage_Core_Block_Abstract $block
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setParentBlock(Mage_Core_Block_Abstract $block)
{
Expand All @@ -288,7 +288,7 @@ public function getAction()
* Set layout object
*
* @param Mage_Core_Model_Layout $layout
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setLayout(Mage_Core_Model_Layout $layout)
{
Expand All @@ -304,7 +304,7 @@ public function setLayout(Mage_Core_Model_Layout $layout)
*
* You can redefine this method in child classes for changing layout
*
* @return Mage_Core_Block_Abstract
* @return $this
*/
protected function _prepareLayout()
{
Expand Down Expand Up @@ -334,7 +334,7 @@ public function getIsAnonymous()
* Set the anonymous flag
*
* @param bool $flag
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setIsAnonymous($flag)
{
Expand All @@ -356,7 +356,7 @@ public function getAnonSuffix()
* Set anonymous suffix for current block
*
* @param string $suffix
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setAnonSuffix($suffix)
{
Expand All @@ -378,7 +378,7 @@ public function getBlockAlias()
* Set block alias
*
* @param string $alias
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setBlockAlias($alias)
{
Expand All @@ -390,7 +390,7 @@ public function setBlockAlias($alias)
* Set block's name in layout and unsets previous link if such exists.
*
* @param string $name
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setNameInLayout($name)
{
Expand Down Expand Up @@ -420,7 +420,7 @@ public function getSortedChildren()
*
* @param string $name
* @param mixed $value
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setAttribute($name, $value = null)
{
Expand All @@ -432,7 +432,7 @@ public function setAttribute($name, $value = null)
*
* @param string $alias
* @param Mage_Core_Block_Abstract $block
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setChild($alias, $block)
{
Expand Down Expand Up @@ -473,7 +473,7 @@ public function setChild($alias, $block)
* Unset child block
*
* @param string $alias
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function unsetChild($alias)
{
Expand Down Expand Up @@ -508,7 +508,7 @@ public function unsetChild($alias)
* @param string $callback
* @param mixed $result
* @param array $params
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function unsetCallChild($alias, $callback, $result, $params)
{
Expand All @@ -532,7 +532,7 @@ public function unsetCallChild($alias, $callback, $result, $params)
/**
* Unset all children blocks
*
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function unsetChildren()
{
Expand Down Expand Up @@ -737,7 +737,7 @@ public function insert($block, $siblingName = '', $after = false, $alias = '')
* Sort block's children
*
* @param boolean $force force re-sort all children
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function sortChildren($force = false)
{
Expand Down Expand Up @@ -784,7 +784,7 @@ public function sortChildren($force = false)
*
* @param Mage_Core_Block_Abstract|string $block
* @param string $alias
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function append($block, $alias = '')
{
Expand Down Expand Up @@ -812,7 +812,7 @@ public function addToChildGroup($groupName, Mage_Core_Block_Abstract $child)
* Add self to the specified group of parent block
*
* @param string $groupName
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function addToParentGroup($groupName)
{
Expand Down Expand Up @@ -849,7 +849,6 @@ public function getChildGroup($groupName, $callback = null, $skipEmptyResults =
} else {
$result[$alias] = $block;
}

}
}
return $result;
Expand All @@ -873,7 +872,7 @@ public function getChildData($alias, $key = '')
/**
* Before rendering html, but after trying to load cache
*
* @return Mage_Core_Block_Abstract
* @return $this
*/
protected function _beforeToHtml()
{
Expand All @@ -885,7 +884,7 @@ protected function _beforeToHtml()
*
* @param $openTag
* @param $closeTag
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setFrameTags($openTag, $closeTag = null)
{
Expand Down Expand Up @@ -914,7 +913,7 @@ final public function toHtml()
$html = $this->_loadCache();
if ($html === false) {
$translate = Mage::getSingleton('core/translate');
/** @var $translate Mage_Core_Model_Translate */
/** @var Mage_Core_Model_Translate $translate */
if ($this->hasData('translate_inline')) {
$translate->setTranslateInline($this->getData('translate_inline'));
}
Expand Down Expand Up @@ -942,10 +941,12 @@ final public function toHtml()
if (self::$_transportObject === null) {
self::$_transportObject = new Varien_Object;
}
self::$_transportObject->setHtml($html);
Mage::dispatchEvent('core_block_abstract_to_html_after',
array('block' => $this, 'transport' => self::$_transportObject));
$html = self::$_transportObject->getHtml();
self::$_transportObject->setData('html', $html);
sreichel marked this conversation as resolved.
Show resolved Hide resolved
Mage::dispatchEvent(
'core_block_abstract_to_html_after',
array('block' => $this, 'transport' => self::$_transportObject)
);
$html = self::$_transportObject->getData('html');

return $html;
}
Expand Down Expand Up @@ -1072,7 +1073,7 @@ public function getMessagesBlock()
* Set messages block
*
* @param Mage_Core_Block_Messages $block
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function setMessagesBlock(Mage_Core_Block_Messages $block)
{
Expand All @@ -1084,7 +1085,7 @@ public function setMessagesBlock(Mage_Core_Block_Messages $block)
* Return block helper
*
* @param string $type
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function getHelper($type)
{
Expand Down Expand Up @@ -1161,8 +1162,11 @@ public function __()
}

/**
* @deprecated after 1.4.0.0-rc1
* @param string|array $data
* @param array $allowedTags
* @return string
* @see self::escapeHtml()
* @deprecated after 1.4.0.0-rc1
*/
public function htmlEscape($data, $allowedTags = null)
{
Expand All @@ -1172,7 +1176,7 @@ public function htmlEscape($data, $allowedTags = null)
/**
* Escape html entities
*
* @param mixed $data
* @param string|array $data
* @param array $allowedTags
* @return string
*/
Expand All @@ -1195,6 +1199,8 @@ public function stripTags($data, $allowableTags = null, $allowHtmlEntities = fal
}

/**
* @param string $data
* @return string
* @deprecated after 1.4.0.0-rc1
* @see self::escapeUrl()
*/
Expand Down Expand Up @@ -1261,7 +1267,7 @@ public function countChildren()
/**
* Prepare url for save to cache
*
* @return Mage_Core_Block_Abstract
* @return $this
*/
protected function _beforeCacheUrl()
{
Expand Down Expand Up @@ -1353,7 +1359,7 @@ public function getCacheTags()
* Add tag to block
*
* @param string|array $tag
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function addCacheTag($tag)
{
Expand All @@ -1368,7 +1374,7 @@ public function addCacheTag($tag)
* Add tags from specified model to current block
*
* @param Mage_Core_Model_Abstract $model
* @return Mage_Core_Block_Abstract
* @return $this
*/
public function addModelTags(Mage_Core_Model_Abstract $model)
{
Expand Down Expand Up @@ -1404,7 +1410,7 @@ protected function _loadCache()
return false;
}
$cacheKey = $this->getCacheKey();
/** @var $session Mage_Core_Model_Session */
/** @var Mage_Core_Model_Session $session */
$session = Mage::getSingleton('core/session');
$cacheData = $this->_getApp()->loadCache($cacheKey);
if ($cacheData) {
Expand All @@ -1421,15 +1427,15 @@ protected function _loadCache()
* Save block content to cache storage
*
* @param string $data
* @return Mage_Core_Block_Abstract
* @return $this|false
*/
protected function _saveCache($data)
{
if (is_null($this->getCacheLifetime()) || !$this->_getApp()->useCache(self::CACHE_GROUP)) {
return false;
}
$cacheKey = $this->getCacheKey();
/** @var $session Mage_Core_Model_Session */
/** @var Mage_Core_Model_Session $session */
$session = Mage::getSingleton('core/session');
$data = str_replace(
$session->getSessionIdQueryParam() . '=' . $session->getEncryptedSessionId(),
Expand Down Expand Up @@ -1487,7 +1493,7 @@ protected function _getSidPlaceholder($cacheKey = null)
public function getItemsTags($items)
{
$tags = array();
/** @var $item Mage_Core_Model_Abstract */
/** @var Mage_Core_Model_Abstract $item */
foreach ($items as $item) {
$itemTags = $item->getCacheIdTags();
if (false === $itemTags) {
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Core/Block/Flush.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Immediate flush block. To be used only as root
*
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Core_Block_Flush extends Mage_Core_Block_Abstract
{

/**
* @return string
*/
protected function _toHtml()
{
if (!$this->_beforeToHtml()) {
Expand All @@ -49,5 +50,4 @@ protected function _toHtml()
echo $block->toHtml();
}
}

}
6 changes: 5 additions & 1 deletion app/code/core/Mage/Core/Block/Html/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
*/
class Mage_Core_Block_Html_Calendar extends Mage_Core_Block_Template
{
/**
* @return string
* @throws Zend_Locale_Exception
*/
protected function _toHtml()
{
$localeCode = Mage::app()->getLocale()->getLocaleCode();
Expand Down Expand Up @@ -61,7 +65,7 @@ protected function _toHtml()
$this->assign('pm', Mage::helper('core')->jsonEncode(Zend_Locale_Data::getContent($localeCode, 'pm')));

// get first day of week and weekend days
$this->assign('firstDay', (int)Mage::getStoreConfig('general/locale/firstday'));
$this->assign('firstDay', (int)Mage::getStoreConfig('general/locale/firstday'));
$this->assign('weekendDays', Mage::helper('core')->jsonEncode((string)Mage::getStoreConfig('general/locale/weekend')));

// define default format and tooltip format
Expand Down
Loading