Open willguv opened 3 months ago
Hi @MariosORION did you get chance to look at this? Thanks
Am looking for a few more issues for you if OK
@willguv yes I've tried a few things but it's proving more tricky than I thought - I'll post my findings shortly.
Am looking for a few more issues for you if OK
Yes, please do
To POC this, I've enabled localgov_workflows_notifications and created a service contact entity (associated to a Drupal user). Then, on the content View, I've added a new exposed filter "Service contacts" but only insufficient operators are available by default ("Is equal to" requires the user to enter the entity ID which is not very practical):
The operator we need here is "is one of" similarly to the content type select list but this is not available by default for entity reference fields in content (such as service contact field on LGD nodes).
I've tried Views Entity Reference Filter ; it does provide the required exposed filter operator but it comes with fatal errors when "Filter" is pressed on the enhanced content View.
There are a couple of patches available for similar issues but neither of them seems to work.
Better exposed filters doesn't provide the results required either.
I'm thinking of writing a custom filter and adding it to the content View programmatically but that's considerably more work so it makes sense to ask for alternative suggestions, if any?
following with interest
@stephen-cox is suggesting looking at a hook_form_alter on the exposed field to generate a nicer user experience.
@MariosORION if you can share the fatal error, perhaps we can fix the Views Entity Reference Filter issue ?
@rupertj has used Views Entity Reference Filter with success.
On the deployment question, we want to keep this as an optional feature for existing sites.
One option could be a different view like /admin/content-by-owner
PR https://github.com/localgovdrupal/localgov_workflows/pull/104 ready for review.
Changes:
Adding new View page /admin/content/localgov-content-by-owner that lists content by owner (relationship to service contact required):
Adding dynamic menu link that only gets placed if the View above is present:
Adding dynamic local task that only gets generated if the View above is present (see below for screenshot). I've tested this with a new user, service contact tied to that user and a service page with that service contact assigned; here's how the new View looks like (some columns are sortable just like the vanilla content View):
To add the View when localgov_workflow_notifications is already enabled, Councils can manually import the View's YML configuration (views.view.localgov_content_by_owner.yml) into their site: views.view.localgov_content_by_owner.yml.zip
Benefits of this approach:
Possible cons of this approach:
Thanks for doing this @MariosORION - could you add a screenshot to this page?
Is there a composer command I can use to install this branch?
@willguv it should be something like:
composer require "localgovdrupal/localgov_workflows":"dev-feature/85-content-filter-by-service-contact" --with-all-dependencies
but I haven't tested it yet.
I've added description and screenshots from the PR in my previous comment here.
Following on from https://github.com/localgovdrupal/localgov_workflows/issues/12
Content designers would like a view showing the pages assigned to a specific service owner
Could we add a 'service contact' drop down to filter the main content view at /admin/content?
The order would be
Title / Content type / Published status / Service owner / Language
This is based on amount of use each gets - my hunch is editors would use it less than published status but more than language