Search code examples
layoutmagentoblockhelperreview

Where is the "Helper" block of the "Review" Module registered?


I want to customize the review summary block on the product page, but I can't seem to find where the Helper block (this is a block called "Helper", it is not a helper") of the Review module is registered (connected to a real class name) in the existing layout xml.

I dug a little into the Magento core code to see how a line like:

$this->getLayout->createBlock('modulename/blockname');

evaluates to something like: 'Namespace_Modulename_Block_Blockname'

Somehow the XML-configuration in memory does contain a review group and a helper, as seen in the file app/code/core/Mage/Core/Model/Config.php on line 1173:

1164  $classArr = explode('/', trim($classId));
1165  $group = $classArr[0];
1166  $class = !empty($classArr[1]) ? $classArr[1] : null;
1167  
1168  if (isset($this->_classNameCache[$groupRootNode][$group][$class])) {
1169      return $this->_classNameCache[$groupRootNode][$group][$class];
1170  }
1171  
1172  //$config = $this->getNode($groupRootNode.'/'.$group);
1173  $config = $this->_xml->global->{$groupType.'s'}->{$group};
1174  
1175  if (isset($config->rewrite->$class)) {
1176      $className = (string)$config->rewrite->$class;
1177  } else {
1178      if (!empty($config)) {
1179          $className = $config->getClassName();

I checked using Mage::log's that the code that follows line 1173 can get the needed information out of the $config object.

If anyone can give me tips on this, it'll be greatly appreciated.


Solution

  • If you take a look at

    app/code/core/Mage/Review/etc/config.xml
    

    You can see that there's a node at

    <config>
        <global>
            <blocks>
                <review>
                    <class>Mage_Review_Block</class>
                </review>
            </blocks>
        </global>
    </config>
    

    This registers review as a group for blocks. After that, there's no need to specifically configure a block named Helper, as the class portion of an alias (groupname/classname) will be Leading_Camel_Cased and appended to the class configured for the group.