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