3 namespace Drupal\pathauto;
5 use Drupal\path\Plugin\Field\FieldType\PathFieldItemList;
7 class PathautoFieldItemList extends PathFieldItemList {
12 protected function delegateMethod($method) {
13 // @todo Workaround until this is fixed, see
14 // https://www.drupal.org/project/drupal/issues/2946289.
15 $this->ensureComputedValue();
17 // Duplicate the logic instead of calling the parent due to the dynamic
20 $args = array_slice(func_get_args(), 1);
21 foreach ($this->list as $delta => $item) {
22 // call_user_func_array() is way slower than a direct call so we avoid
23 // using it if have no parameters.
24 $result[$delta] = $args ? call_user_func_array([$item, $method], $args) : $item->{$method}();
32 protected function computeValue() {
33 parent::computeValue();
35 // For a new entity, default to creating a new alias.
36 if ($this->getEntity()->isNew()) {
37 $this->list[0]->set('pathauto', PathautoState::CREATE);