The Entityqueue module allows users to create queues of any entity type. Each queue is implemented as an Entity Reference field, that can hold a single entity type.
For instance, you can create a queue of:
Nodes
Users
Taxonomy Terms
etc.
Entityqueue provides Views integration, by adding an Entityqueue relationship to
your view, and adding a sort for Entityqueue position.
Entityqueue Module Installation
with composer : $ composer require 'drupal/entityqueue:^1.2'
Adding an entity queue
We need to configure a few things for Entityqueue to use.
1 - Go to ‘Structure’ → click on Entityqueue
If you are configuring the first time, you need to add an entity queue. Else, you can also work with the existing one.
2 - Now Add Entity Queue page. Give a name for your Entityqueue and choose a type - Multiple sub queues or single Queue.
3 - In a single sub-queue, you can directly add items whereas in multiple sub-queues you can add multiple sub-queues which hold different items.
Entity Settings
When exploring the 'entity type' following are some of the options you will come across:
Type of items to the queue: Choose a type of item you want to queue from the drop-down. Let’s opt for a content type.
Reference method: Refer a view with an Entity Reference display. Set the reference by default.
Content type: Select a content type. Let’s choose the article here.
Sort by: Set as none. We will add this in View.
Queue Settings
When exploring the 'queue settings' you can set a range for the queue with minimum and maximum items.
Reverse order in admin view: This will display the queue such that the items will be added to the top and removed from the bottom.
Creating View for the Content Type
Go to structure → click on View → Add View.
Configure the View for creating an arbitrary list
Add a view name to view basic information section. And give a description by just checking the option description. Add the information as you need, and click Save.
Configuring View
Now its time to configure the view.
Relationships: When you go to the advanced section, you will see the option of relationships. Click on Add Button on the same row of Relationships. A popup will come and here you have to search for the content queue and click on Add and configure relationships.
You can see the specific entity queue that you have created earlier. Enable the relationship option which hides item those don’t have the relationship.
Sort Criteria: Next, you need to add short criteria for Entityqueue. Click on Add button beside Sort criteria. A popup will appear where you need to select the option of Content Queue Position and enable it. Remember that you must remove all other existing criteria.
Configure the sort criterion: Here you can select the ordering (asc/dsc) for the position and can expose this sort to the visitor to change it. Then click on Apply.
Configure Entityqueues
Configure Entityqueues to use. Go to ‘Structure’ → Entityqueues → Edit Items on the same row of Queue that you have created
Edit the subqueue Featured Posts.
Here you can add items as many you wish by just clicking a button Add another item. Then click on Save.
You have successfully created Entityqueue for your content.
No comments:
Post a Comment