According to the NumericFilter.php file (L150)

if the definition allows for the empty operator, add it.

This module's main function nulls out the publish_on and unpublish_on fields when it runs, so it would be great if you could use that information in a view to collect all unpublished & unscheduled nodes.

Please add this to the field definitions so that you don't have to add a relationship to force it to "allow empty".

If there are relationships in the view, allow empty should be true
so that we can do IS NULL checks on items. Not all filters respect
allow empty, but string and numeric do and that covers enough.

Comments

jklmnop created an issue. See original summary.

jonathan1055’s picture

Hi jklmnop,
This sounds like a useful addition. Is something that can be added via the admin views interface, then exported? If so, can you have a go at customising the scheduler view, then export and I will see how it works.
Jonathan

jklmnop’s picture

StatusFileSize
new23.13 KB

I believe the field definition setting "allow empty" is supposed to be in code somewhere, probably a class, but I'm not entirely sure. It does not appear to be a setting that can be set via the views admin interface.

The scheduler view already does the relationship workaround. I realized that after I figured out that relationships force "allow empty" availability on fields.

I've attached a copy of views.view.scheduler_scheduled_content.yml (the file uploader changed the name for some reason)

I've duplicated the main view but removed the author relationship and name field so you can see the lack of "is empty/is not empty" operators in the publish_on/unpublish_on fields.

adamevertsson’s picture

Yes, oh yes! Please add this. This has been bugging me for so long. It's very annoying to have to do a workaround for this, every time I need a new listing of the content that is or isn't scheduled for publishing. Would really enjoy such an update to the module.

// Adam

jonathan1055’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new177.37 KB
new59.54 KB
new942 bytes

Hi @jklmnop and @AdamEvertsson,

I did some investigation and FilterPluginBase has this comment

 * The following items can go into a hook_views_data() implementation in a
 * filter section to affect how the filter handler will behave:
 * - allow empty: If true, the 'IS NULL' and 'IS NOT NULL' operators become
 *   available as standard operators.

So Scheduler can implement hook_views_data_alter() to add the 'allow empty' filter setting. Here's a patch for testing which works for me - see screen grabs. However, this is not covered by any phpunit tests, so it will need your manual testing also to verify it.

Jonathan

jonathan1055’s picture

@jklmnop @AdamEvertsson
Have you managed to test my patch in #5 yet? I would like to get this into the next release of Scheduler which will be in a few weeks time.
Thanks.

jklmnop’s picture

@jonathan1055

I’m sorry for the delay, I explored this issue and posted this ticket for another person on my team.

I did let them know about your patch but I see that we never rolled it in our composer file.

Thank you for the help! I will test this patch on Monday.

jklmnop’s picture

@jonathan1055

The patch applied just fine (Drupal 9.1.9 with Scheduler 8.x-1.x). I imagine it works the same on D8.

I created a new view and added Publish and Unpublish fields and verified that the "is empty"/"is not empty" options showed up without the use of a relationship.

Thank you!

  • jonathan1055 committed b9d1799 on 8.x-1.x
    Issue #3049134 by jonathan1055, jklmnop: Publish/Unpublish fields do not...
jonathan1055’s picture

Status: Needs review » Fixed

Thanks for testing, good to hear it worked for you without any problem.
Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ladybug_3777’s picture

Just adding a comment that I tried this patch on my Drupal 9.2 site and it works great. Thank you!

NOTE - I had to apply the patch via composer as it was not included in version 8.x-1.3 when I downloaded it....

jonathan1055’s picture

Hi ladybug_3777,
Pleased to hear that it works for you.
Yes, the patch has been committed to 8.x-1.x dev but I have not released 8.x-1.4 yet. That is coming very soon, see #3150881: Plan for Scheduler 8.x-1.4 release