本文整理匯總了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;
}