- Issue created by @james.williams
- Status changed to Needs review
over 1 year ago 11:30am 27 April 2023 - 🇬🇧United Kingdom james.williams
Here you go - a nice & simple patch :) The context array will be available in hooks via
$entity->context
, and will get otherwise ignored whilst saving a log entity. - Status changed to Postponed
over 1 year ago 5:41am 4 May 2023 - 🇨🇳China zterry95
In this case, service decorator is a better option; http_client_log.services.yml is an example.
- 🇬🇧United Kingdom james.williams
I'm well aware that service decorators could be ideal (and I have implemented many before elsewhere); but I don't see how that would help here? I'm looking for a way to get something from the options array, into the log entity. The log entity is created inside
\Drupal\http_client_log\Logger\Logger::log()
, and as far I can see, that whole method would need replacing in order to do this, so decoration couldn't really help, unless that class was first rearchitected to introduce an opportunity in between the entity being created and saved?If decoration, or replacing the service class was used, there's not much from this module that's actually left in use, beyond the entity type definition. Which seems a shame! My suggestion to include the context in the log entity is simply to make the data available so that there is an opportunity for extensibility.
Or can you help me see how decoration could actually be used to take input from the options array, to set field values on the log entity, given the current module code?
-
zterry95 →
committed 6096cfa3 on 1.0.x authored by
james.williams →
Issue #3356864 by james.williams: Allow hooks to use options in context
-
zterry95 →
committed 6096cfa3 on 1.0.x authored by
james.williams →
- Status changed to Fixed
over 1 year ago 6:02am 8 May 2023 Automatically closed - issue fixed for 2 weeks with no activity.