Open Polynya opened 7 months ago
Should be tested against JSON:API (think @Polynya you were fixing that) and the other issue #80 translation (@ekes myself maybe)
Chatting about this at merge Tuesday and not sure who the best person to test this is.
@ekes was wondering is @joachim-n had an opinion on the best way to do computed fields like this so they're available for specific bundles.
According to https://www.drupal.org/project/computed_field/issues/3353839, bundle fields defined in code don't show in jsonapi output.
I'm not sure what's needed to fix this - https://www.drupal.org/project/drupal/issues/3252278 is the core issue.
@Polynya could you check this one and resolve merge conflicts? Also, happy to help test, if you can tell me what I need to do.
This also works to fix the issue with #77 I was having with entity share
This looks like something we should work on, but we've let slip a little bit.
Anyone fancy picking it up again to
I've fixed the git conflict.
I've confirmed that this doesn't break our current functionality and have used this approach when adding another field used by workflows here:
Ideally this should also be tested by someone with the who's using the JSON:API with LocalGov Drupal, but we could just agree this is a better approach.
The failing test here is https://github.com/localgovdrupal/localgov_workflows/blob/da449dd41b5fe2eb3da9979bb0a27bb51a52fb7b/modules/localgov_review_date/tests/src/Functional/NodeFormTest.php#L61
// Check review status widget doesn't display if schedule transitions are
// not configured.
$this->drupalGet('node/add/page');
$assert_session->elementNotExists('css', '.review-date-form');
Looking I can't say I'm any the wiser. Probably one for someone who knows this better to check.
This is my workaround which uses hook_entity_base_field_info() instead of hook_entity_bundle_field_info(). This adds the field to all bundles so they are hidden on non-scheduled bundles with a form alter.