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


PHP Service::getCalculatedFieldValueForEditMode方法代码示例

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


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

示例1: getDataForEditmode

 /**
  * @see Object_Class_Data::getDataForEditmode
  * @param float $data
  * @return float
  */
 public function getDataForEditmode($data, $object = null)
 {
     if ($data instanceof Model\Object\Data\CalculatedValue) {
         $data = Model\Object\Service::getCalculatedFieldValueForEditMode($object, $data);
     }
     return $data;
 }
开发者ID:jjpeters67,项目名称:pimcore,代码行数:12,代码来源:CalculatedValue.php

示例2: getLocalizedKeyValue

 /**
  * @param $keyId
  * @param $groupId
  * @param string $language
  * @param bool|false $ignoreFallbackLanguage
  * @return null
  */
 public function getLocalizedKeyValue($groupId, $keyId, $language = "default", $ignoreFallbackLanguage = false, $ignoreDefaultLanguage = false)
 {
     $oid = $this->object->getId();
     $keyConfig = Model\Object\Classificationstore\DefinitionCache::get($keyId);
     if ($keyConfig->getType() == "calculatedValue") {
         $data = new Model\Object\Data\CalculatedValue($this->getFieldname());
         $childDef = Model\Object\Classificationstore\Service::getFieldDefinitionFromKeyConfig($keyConfig);
         $data->setContextualData("classificationstore", $this->getFieldname(), null, $language, $groupId, $keyId, $childDef);
         $data = Model\Object\Service::getCalculatedFieldValueForEditMode($this->getObject(), $data);
         return $data;
     }
     $fieldDefinition = Model\Object\Classificationstore\Service::getFieldDefinitionFromKeyConfig($keyConfig);
     $language = $this->getLanguage($language);
     $data = null;
     if (array_key_exists($groupId, $this->items) && array_key_exists($keyId, $this->items[$groupId]) && array_key_exists($language, $this->items[$groupId][$keyId])) {
         $data = $this->items[$groupId][$keyId][$language];
     }
     // check for fallback value
     if ($fieldDefinition->isEmpty($data) && !$ignoreFallbackLanguage && self::doGetFallbackValues()) {
         $data = $this->getFallbackValue($groupId, $keyId, $language, $fieldDefinition);
     }
     if ($fieldDefinition->isEmpty($data) && !$ignoreDefaultLanguage && $language != "default") {
         $data = $this->items[$groupId][$keyId]["default"];
     }
     // check for inherited value
     $doGetInheritedValues = AbstractObject::doGetInheritedValues();
     if ($fieldDefinition->isEmpty($data) && $doGetInheritedValues) {
         $object = $this->getObject();
         $class = $object->getClass();
         $allowInherit = $class->getAllowInherit();
         if ($allowInherit) {
             if ($object->getParent() instanceof AbstractObject) {
                 $parent = $object->getParent();
                 while ($parent && $parent->getType() == "folder") {
                     $parent = $parent->getParent();
                 }
                 if ($parent && ($parent->getType() == "object" || $parent->getType() == "variant")) {
                     if ($parent->getClassId() == $object->getClassId()) {
                         $method = "getLocalizedfields";
                         if (method_exists($parent, $method)) {
                             $getter = "get" . ucfirst($this->fieldname);
                             $classificationStore = $parent->{$getter}();
                             if ($classificationStore instanceof Classificationstore) {
                                 if ($classificationStore->object->getId() != $this->object->getId()) {
                                     $data = $classificationStore->getLocalizedKeyValue($groupId, $keyId, $language, false);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($fieldDefinition && method_exists($fieldDefinition, "preGetData")) {
         $data = $fieldDefinition->preGetData($this, array("data" => $data, "language" => $language, "name" => $groupId . "-" . $keyId));
     }
     return $data;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:65,代码来源:Classificationstore.php


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