- Issue created by @junkuncz
- Issue was unassigned.
- Status changed to Needs review
8 months ago 11:29am 7 August 2024 - 🇭🇺Hungary junkuncz Budapest
Phpstan report is irrelevant regarding code changes. Ready for review.
- 🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU
Random FYI
I now briefly checked 📌 Improve CustomElement::createFromRenderArray() to better handle entites that render to custom elements Active and understand what that issue is about and why.
But that (i.e. some logic that 'strips down' the render array) won't help with using the Core formatter for dates for timestamp/created/changed fields. It just has too many options, optionally a tooltip, optionally attached JS libraries... (Which is why it has its own #theme function.)
...Unless we add a config option to Core field formatters, to just take the literal value from the #text key, and discard literally everything else. But that doesn't feel very useful to me, at the moment.
- Status changed to Needs work
8 months ago 1:59pm 13 August 2024 - Status changed to Needs review
8 months ago 3:27pm 13 August 2024 - Status changed to RTBC
8 months ago 3:55pm 13 August 2024 - 🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU
I'll set this to RTBC and I might commit this.
But i will wait to see if my (still to be made) issue about changing CustomElementsFieldFormatterBase::getSetting() gets reviewed soon. If so, and if @fago feels that the
$configuration = $this->configuration + $this->defaultSettings();
is 'code pollution' after that, we might still change that. - Assigned to fago
- Issue was unassigned.
- 🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU
Rebased (because Github complains the branch is un-mergeable for no reason), and added 1 commit which updates to our latest conventions, now that 📌 Doublecheck CustomElementsFieldFormatterBase::getSetting() Active is committed.
Some summary of that issue's outcome and our code conventions that I will stick to:
- We use
$this->configuration[KEY]
instead of$this->getSetting(KEY)
in our code. (They are interchangeable; we are apparently acting as if getSetting() does not exist, because we would rather it didn't exist. But it's part of an interface we implement, so we can't remove it.) - never implement
defaultSetttings()
(which we also would rather see disappear); always implementdefaultConfiguration()
. KEY
does not need to be checked for existence, as long as it's defined indefaultConfiguration()
+ we are implementingCustomElementsFieldFormatterBase
, which merges the defaults into$this->configuration
In the meantime, FileCeFieldFormatter got similar additions in ✨ Create a image-style dropdown to the file/image formatter Fixed which also needs to be updated according to the same conventions. Doing that in the same commit.
Also:
I was wondering about 'optional' configuration values. My feeling says that I don't like them always being present, in saved configuration. (Why would we save e.g.
custom_format: ""
when we never set or use it?). However,- It is easier for the code, to define it in
defaultConfiguration()
- I tested Core field formatters, and they (at least TimestampFormatter) also always export all configuration settings, including optional/empty ones. So let's treat that as convention, then.
- We use
-
roderik →
committed 8e5d6973 on 3.x authored by
junkuncz →
Issue #3466510 by junkuncz, roderik: Add CE field formatter for...
-
roderik →
committed 8e5d6973 on 3.x authored by
junkuncz →
Automatically closed - issue fixed for 2 weeks with no activity.