PathautoFieldItemList.php in Pathauto 8
File
src/PathautoFieldItemList.php
View source
<?php
namespace Drupal\pathauto;
use Drupal\path\Plugin\Field\FieldType\PathFieldItemList;
class PathautoFieldItemList extends PathFieldItemList {
protected function delegateMethod($method) {
$this
->ensureComputedValue();
$result = [];
$args = array_slice(func_get_args(), 1);
foreach ($this->list as $delta => $item) {
$result[$delta] = $args ? call_user_func_array([
$item,
$method,
], $args) : $item
->{$method}();
}
return $result;
}
protected function computeValue() {
parent::computeValue();
if ($this
->getEntity()
->isNew()) {
$this->list[0]
->set('pathauto', PathautoState::CREATE);
}
}
}