当前位置: 首页>>代码示例>>PHP>>正文


PHP Object::getValue方法代码示例

本文整理汇总了PHP中Magento\Framework\Object::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getValue方法的具体用法?PHP Object::getValue怎么用?PHP Object::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Object的用法示例。


在下文中一共展示了Object::getValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatValue

 /**
  * Format total value based on order currency
  *
  * @param \Magento\Framework\Object $total
  * @return string
  */
 public function formatValue($total)
 {
     if (!$total->getIsFormated()) {
         return $this->_adminHelper->displayPrices($this->getOrder(), $total->getBaseValue(), $total->getValue());
     }
     return $total->getValue();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:Totals.php

示例2: _addField

 /**
  * Add field to Options form based on parameter configuration
  *
  * @param \Magento\Framework\Object $parameter
  * @return \Magento\Framework\Data\Form\Element\AbstractElement
  */
 protected function _addField($parameter)
 {
     $form = $this->getForm();
     $fieldset = $this->getMainFieldset();
     //$form->getElement('options_fieldset');
     // prepare element data with values (either from request of from default values)
     $fieldName = $parameter->getKey();
     $data = array('name' => $form->addSuffixToName($fieldName, 'parameters'), 'label' => __($parameter->getLabel()), 'required' => $parameter->getRequired(), 'class' => 'widget-option', 'note' => __($parameter->getDescription()));
     if ($values = $this->getWidgetValues()) {
         $data['value'] = isset($values[$fieldName]) ? $values[$fieldName] : '';
     } else {
         $data['value'] = $parameter->getValue();
         //prepare unique id value
         if ($fieldName == 'unique_id' && $data['value'] == '') {
             $data['value'] = md5(microtime(1));
         }
     }
     // prepare element dropdown values
     if ($values = $parameter->getValues()) {
         // dropdown options are specified in configuration
         $data['values'] = array();
         foreach ($values as $option) {
             $data['values'][] = array('label' => __($option['label']), 'value' => $option['value']);
         }
         // otherwise, a source model is specified
     } elseif ($sourceModel = $parameter->getSourceModel()) {
         $data['values'] = $this->_sourceModelPool->get($sourceModel)->toOptionArray();
     }
     // prepare field type or renderer
     $fieldRenderer = null;
     $fieldType = $parameter->getType();
     // hidden element
     if (!$parameter->getVisible()) {
         $fieldType = 'hidden';
         // just an element renderer
     } elseif ($fieldType && $this->_isClassName($fieldType)) {
         $fieldRenderer = $this->getLayout()->createBlock($fieldType);
         $fieldType = $this->_defaultElementType;
     }
     // instantiate field and render html
     $field = $fieldset->addField($this->getMainFieldsetHtmlId() . '_' . $fieldName, $fieldType, $data);
     if ($fieldRenderer) {
         $field->setRenderer($fieldRenderer);
     }
     // extra html preparations
     if ($helper = $parameter->getHelperBlock()) {
         $helperBlock = $this->getLayout()->createBlock($helper->getType(), '', array('data' => $helper->getData()));
         if ($helperBlock instanceof \Magento\Framework\Object) {
             $helperBlock->setConfig($helper->getData())->setFieldsetId($fieldset->getId())->prepareElementHtml($field);
         }
     }
     // dependencies from other fields
     $dependenceBlock = $this->getChildBlock('form_after');
     $dependenceBlock->addFieldMap($field->getId(), $fieldName);
     if ($parameter->getDepends()) {
         foreach ($parameter->getDepends() as $from => $row) {
             $values = isset($row['values']) ? array_values($row['values']) : (string) $row['value'];
             $dependenceBlock->addFieldDependence($fieldName, $from, $values);
         }
     }
     return $field;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:68,代码来源:Options.php

示例3: updateQtyOption

 /**
  * Method is needed for specific actions to change given quote options values
  * according current product type logic
  * Example: the catalog inventory validation of decimal qty can change qty to int,
  * so need to change quote item qty option value too.
  *
  * @param   array           $options
  * @param   \Magento\Framework\Object   $option
  * @param   mixed           $value
  * @param   \Magento\Catalog\Model\Product $product
  * @return $this
  */
 public function updateQtyOption($options, \Magento\Framework\Object $option, $value, $product)
 {
     $optionProduct = $option->getProduct($product);
     $optionUpdateFlag = $option->getHasQtyOptionUpdate();
     $optionCollection = $this->getOptionsCollection($product);
     $selections = $this->getSelectionsCollection($optionCollection->getAllIds(), $product);
     foreach ($selections as $selection) {
         if ($selection->getProductId() == $optionProduct->getId()) {
             foreach ($options as &$option) {
                 if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
                     if ($optionUpdateFlag) {
                         $option->setValue(intval($option->getValue()));
                     } else {
                         $option->setValue($value);
                     }
                 }
             }
         }
     }
     return $this;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:33,代码来源:Type.php

示例4: formatValue

 /**
  * Format total value based on order currency
  *
  * @param   \Magento\Framework\Object $total
  * @return  string
  */
 public function formatValue($total)
 {
     if (!$total->getIsFormated()) {
         return $this->getOrder()->formatPrice($total->getValue());
     }
     return $total->getValue();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Totals.php

示例5: renderRowValue

 /**
  * Get rendered row value
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function renderRowValue(\Magento\Framework\Object $row)
 {
     $value = $row->getValue();
     if (is_array($value)) {
         $value = implode("\n", $value);
     }
     if (!$row->getSkipHtmlEscaping()) {
         $value = $this->escapeHtml($value);
     }
     return nl2br($value);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:View.php


注:本文中的Magento\Framework\Object::getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。