Skip to content
Snippets Groups Projects

fix the issue of Error: Call to a member function isReversed

1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
@@ -13,14 +13,18 @@ class EntitySubqueueItemsFieldItemList extends EntityReferenceFieldItemList {
@@ -13,14 +13,18 @@ class EntitySubqueueItemsFieldItemList extends EntityReferenceFieldItemList {
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function appendItem($value = NULL) {
public function appendItem($value = NULL) {
// If the queue is reversed, new items should be be added to the top of the
// Get the queue associated with the entity.
// queue.
$queue = $this->getEntity()->getQueue();
if ($this->getEntity()->getQueue()->isReversed()) {
 
// Check if the queue is available and is reversed.
 
if ($queue && $queue->isReversed()) {
 
// If the queue is reversed, new items should be added to the top of the queue.
$item = $this->createItem(0, $value);
$item = $this->createItem(0, $value);
array_unshift($this->list, $item);
array_unshift($this->list, $item);
return $item;
return $item;
}
}
 
// If the queue is not reversed or not available, use parent implementation.
return parent::appendItem($value);
return parent::appendItem($value);
}
}
Loading