本文整理汇总了PHP中Varien_Simplexml_Element::is方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Element::is方法的具体用法?PHP Varien_Simplexml_Element::is怎么用?PHP Varien_Simplexml_Element::is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Simplexml_Element
的用法示例。
在下文中一共展示了Varien_Simplexml_Element::is方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFields
/**
* Init fieldset fields
*
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @param Varien_Simplexml_Element $group
* @param Varien_Simplexml_Element $section
* @param string $fieldPrefix
* @param string $labelPrefix
* @return Soon_StockReleaser_Block_Adminhtml_System_Config_Form
*/
public function initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '')
{
if (!$group->is('use_custom_form', 1)) {
return parent::initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '');
}
if (!$this->_configDataObject) {
$this->_initObjects();
}
// Extends for config data
$configDataAdditionalGroups = array();
$paymentMethods = Mage::helper('payment')->getPaymentMethods();
$xmlString = "<config><fields>";
$sort_order = 0;
foreach ($paymentMethods as $code => $paymentMethod) {
if (!isset($paymentMethod['active']) || $paymentMethod['active'] == 0) {
continue;
}
++$sort_order;
$xmlString .= '
<' . $code . ' translate="label">
<label>' . $paymentMethod['title'] . '</label>
<frontend_type>text</frontend_type>
<sort_order>' . $sort_order . '</sort_order>
<validate>validate-number</validate>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</' . $code . '>';
++$sort_order;
$xmlString .= '
<' . $code . '-unit translate="label">
<frontend_type>select</frontend_type>
<source_model>stockreleaser/system_config_source_unit</source_model>
<sort_order>' . $sort_order . '</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</' . $code . '-unit>';
}
$xmlString .= "</fields></config>";
$element = new Mage_Core_Model_Config_Base();
$element->loadString($xmlString);
foreach ($element->getNode('fields') as $elements) {
$elements = (array) $elements;
// sort either by sort_order or by child node values bypassing the sort_order
if ($group->sort_fields && $group->sort_fields->by) {
$fieldset->setSortElementsByAttribute((string) $group->sort_fields->by, $group->sort_fields->direction_desc ? SORT_DESC : SORT_ASC);
} else {
usort($elements, array($this, '_sortForm'));
}
foreach ($elements as $e) {
if (!$this->_canShowField($e)) {
continue;
}
/**
* Look for custom defined field path
*/
$path = (string) $e->config_path;
if (empty($path)) {
$path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName();
} elseif (strrpos($path, '/') > 0) {
// Extend config data with new section group
$groupPath = substr($path, 0, strrpos($path, '/'));
if (!isset($configDataAdditionalGroups[$groupPath])) {
$this->_configData = $this->_configDataObject->extendConfig($groupPath, false, $this->_configData);
$configDataAdditionalGroups[$groupPath] = true;
}
}
$id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName();
if (isset($this->_configData[$path])) {
$data = $this->_configData[$path];
$inherit = false;
} else {
$data = $this->_configRoot->descend($path);
$inherit = true;
}
if ($e->frontend_model) {
$fieldRenderer = Mage::getBlockSingleton((string) $e->frontend_model);
} else {
$fieldRenderer = $this->_defaultFieldRenderer;
}
$fieldRenderer->setForm($this);
$fieldRenderer->setConfigData($this->_configData);
$helperName = $this->_configFields->getAttributeModule($section, $group, $e);
$fieldType = (string) $e->frontend_type ? (string) $e->frontend_type : 'text';
$name = 'groups[' . $group->getName() . '][fields][' . $fieldPrefix . $e->getName() . '][value]';
$label = Mage::helper($helperName)->__($labelPrefix) . ' ' . Mage::helper($helperName)->__((string) $e->label);
$hint = (string) $e->hint ? Mage::helper($helperName)->__((string) $e->hint) : '';
if ($e->backend_model) {
$model = Mage::getModel((string) $e->backend_model);
//.........这里部分代码省略.........
示例2: evaluateIsActive
/**
* Evaluates module is active
*
* @param Varien_Simplexml_Element $other
* @return boolean
*/
protected function evaluateIsActive($other)
{
return $other->is('active');
}