本文整理匯總了PHP中Drupal\Core\Field\FieldItemBase::onChange方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldItemBase::onChange方法的具體用法?PHP FieldItemBase::onChange怎麽用?PHP FieldItemBase::onChange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Field\FieldItemBase
的用法示例。
在下文中一共展示了FieldItemBase::onChange方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name)
{
parent::onChange($property_name);
// Enforce that the computed date is recalculated.
if ($property_name == 'value') {
$this->date = NULL;
}
}
示例2: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name, $notify = TRUE)
{
// Unset processed properties that are affected by the change.
foreach ($this->definition->getPropertyDefinitions() as $property => $definition) {
if ($definition->getClass() == '\\Drupal\\text\\TextProcessed') {
if ($property_name == 'format' || $definition->getSetting('text source') == $property_name) {
$this->writePropertyValue($property, NULL);
}
}
}
parent::onChange($property_name, $notify);
}
示例3: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name, $notify = TRUE)
{
// Enforce that the computed date is recalculated.
if ($property_name == 'value') {
$this->date = NULL;
}
parent::onChange($property_name, $notify);
}
示例4: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name, $notify = TRUE)
{
// Make sure that the target ID and the target property stay in sync.
if ($property_name == 'entity') {
$property = $this->get('entity');
$target_id = $property->isTargetNew() ? static::$NEW_ENTITY_MARKER : $property->getTargetIdentifier();
$this->writePropertyValue('target_id', $target_id);
} elseif ($property_name == 'target_id' && $this->target_id != static::$NEW_ENTITY_MARKER) {
$this->writePropertyValue('entity', $this->target_id);
}
parent::onChange($property_name, $notify);
}
示例5: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name, $notify = TRUE)
{
// Make sure that the value and the language property stay in sync.
if ($property_name == 'value') {
$this->writePropertyValue('language', $this->value);
} elseif ($property_name == 'language') {
$this->writePropertyValue('value', $this->get('language')->getTargetIdentifier());
}
parent::onChange($property_name, $notify);
}
示例6: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name)
{
// Make sure that the value and the language property stay in sync.
if ($property_name == 'value') {
$this->properties['language']->setValue($this->value, FALSE);
} elseif ($property_name == 'language') {
$this->set('value', $this->properties['language']->getTargetIdentifier(), FALSE);
}
parent::onChange($property_name);
}
示例7: onChange
/**
* {@inheritdoc}
*/
public function onChange($property_name)
{
// Make sure that the target ID and the target property stay in sync.
if ($property_name == 'target_id') {
$this->properties['entity']->setValue($this->target_id, FALSE);
} elseif ($property_name == 'entity') {
$this->set('target_id', $this->properties['entity']->getTargetIdentifier(), FALSE);
}
parent::onChange($property_name);
}