/** * Returns the name of a block to use for element rendering * * If a name was not explicitly set via setElementBlock(), it tries * the names '{prefix}_{element type}' and '{prefix}_{element}', where * prefix is either 'qf' or the name of the current group's block * * @param HTML_QuickForm_element form element being rendered * @access private * @return string block name */ function _matchBlock(&$element) { $name = $element->getName(); $type = $element->getType(); if (isset($this->_elementBlocks[$name]) && $this->_tpl->blockExists($this->_elementBlocks[$name])) { if (('group' == $type) || ($this->_elementBlocks[$name] . '_loop' != $this->_tpl->currentBlock)) { return $this->_elementBlocks[$name]; } } if ('group' != $type && 'qf_main_loop' != $this->_tpl->currentBlock) { $prefix = substr($this->_tpl->currentBlock, 0, -5); // omit '_loop' postfix } else { $prefix = 'qf'; } if ($this->_tpl->blockExists($prefix . '_' . $type)) { return $prefix . '_' . $type; } elseif ($this->_tpl->blockExists($prefix . '_' . $name)) { return $prefix . '_' . $name; } else { return $prefix . '_element'; } }