Hello all!
The institution I work for is studying the possibility of migrating to Plone + Volto and I was given the task of testing and implementing a few components.
Between them, there's this sort of "Featured" list of News Items. The default listing block is not what I need, though. I've been trying to implement it using the Training course as basis, but I've hit a wall.
So basically, the component's behavior is as follows:
- The user should be able of selecting 4 News Items that will be exhibited as a list of links on the front-page;
- One of the items should be highlighted with a featured image and bigger text;
- The user should be able to choose in which position each list item will be placed;
- The publication of this component can be scheduled;
- The publication of the News Item isn't directly related to it being shown or not (it's possible for an item from the list to appear again in the featured list after a few days).
This is roughly how it should look like on the front-page:
I know this could be done using the "featured" option that's described in the Training, but its behavior isn't ideal.
Since there's a highlighted item, ordering and scheduling, that would generate a lot of confusion for the user, that would be forced to keep track of which items were already chosen and would need to check them individually constantly to see what was chosen. It would be much better if this could all be assembled in one place. Besides, it's what they're used to in their current CMS.
Speaking about the user interface, I think it'd make more sense if it was possible to do the selection in a sort of control panel instead of creating a new content type, because it would generate a lot of useless pages, and this feature will be used daily, sometimes more than once. I'd like to know if that's possible, since I haven't found anything about how to fetch data from a control panel in Volto yet.
What I managed to do so far:
- I created a new vocabulary that lets the user select only the News Items. I tested the relationship field, but since I found no way to filter it to show only News Items, I gave up on it;
- I used the searchContent() function from actions/search/search as taught by the Training to fetch my "Featured" content type. I limited the search to the last published "Featured" item.
I was able to get the News Items from the vocabulary field like I intended, but I could only fetch the "token" and "title" fields. I could not get the URL because I have no idea how to get it from a token.
I tried using the searchContent() function again to fetch each News Item by their token and the full object, but it fires an exception.
Except for the URL issue, it works somewhat like I wanted, but after I tested the schedule I found out there was an error occurring for anonymous users. I've no idea why this is happening yet, but I think it's trying to get the last "Featured Item" even though the user is not logged in and it's not the correct time to show it yet, so it's returning a null value instead of the last published item that the guest is allowed to see.
So this is basically my use case. I don't know much about Plone or Volto, so I'd appreciate any suggestions and thoughts about the best way of implementing this.