當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Simplexml_Element::is方法代碼示例

本文整理匯總了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);
//.........這裏部分代碼省略.........
開發者ID:FranchuCorraliza,項目名稱:magento,代碼行數:101,代碼來源:Form.php

示例2: evaluateIsActive

 /**
  * Evaluates module is active
  *
  * @param Varien_Simplexml_Element $other
  * @return boolean
  */
 protected function evaluateIsActive($other)
 {
     return $other->is('active');
 }
開發者ID:NatashaOlut,項目名稱:Mage_Test,代碼行數:10,代碼來源:Module.php


注:本文中的Varien_Simplexml_Element::is方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。