本文整理汇总了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;
}
示例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;
}