Pending/Done & "Now" option for logs

Thanks for raising this again @marlonv! Let’s get something done! (pun intended)

I do agree that it might make more sense for logs to be “done” by default, in general. That would be a very quick solution. A better solution would be to use JS to auto-toggle done/pending based on timestamp, as we described in the past: Log Category defaults - setting or avoiding them - #5 by mstenta

I will add both of these to my near-term todo list and see what I can do…

In the meantime, if you would like a temporary solution, add these two files to a new sites/all/modules/log_done directory, and then enable this module in your instance:

log_done.info.yml:

name: Default logs to done
description: Sets the default value for log status to done.
type: module
package: farmOS Contrib
core_version_requirement: ^10
dependencies:
  - log:log

log_done.module

<?php

/**
 * Implements hook_entity_base_field_info_alter().
 */
function log_done_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  if ($entity_type->id() == 'log') {
    $fields['status']->setDefaultValue('done');
  }
}

That will set the default value of the log status field to done everywhere. Once we get a “proper” solution in farmOS core (which may end up being the same as this!) you’ll be able to uninstall and delete this temporary module.

Hope that helps in the short term!

Oh you may be experiencing a bug that we found and fixed in 3.0.1: Patch drupal/core for issue 3414883 by paul121 · Pull Request #771 · farmOS/farmOS · GitHub

It requires a patch to Drupal core. If you update to 3.0.1 then that patch will be included with farmOS.

1 Like