Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
On a high level perspective there are examples like blocks which should return immutable HTML fragments, but other places, like the HTML page which should be mutable. Currently the HtmlFragment is mutable (totally fine) and the HtmlFragmentInterface is not (also fine from a high level perspective, you can argue here but it is the case atm.).
Proposed resolution
Introduce a MutableHtmlFragmentInterface which will also be implemented by the HtmlFragment which contains methods like setTitle().
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#11 | 2339475-Mutable-HTML-fragment-interface.patch | 10.93 KB | fgm |
#8 | 2339475-Mutable-HTML-fragment-interface.patch | 11.21 KB | fgm |
#2 | 2339475-Introduce-a-mutable-HTML-fragment-interface.patch | 6.84 KB | fgm |
Comments
Comment #1
Crell CreditAttribution: Crell commentedComment #2
fgmHere is one possible implementation. I'm not totally sold on this, though :
But at least it seems to work.
Comment #3
dawehnerShould this extend the normal one? Just wondering.
Comment #5
fgm@dawehner : yes, that would obviously be a tempting choice, but then it would violate the basic principle of interface segregation.
I do not see how this change can break the TermTranslationFieldViewTest, though. Especially as it passes on my machine. Bot fluke ?
Comment #7
dawehner@crell agreed that we should extend the interface.
test was broken.
Comment #8
fgmRerolled accordingly. This turned out to allow more extensive use of the interface. Let's see if it breaks any tests.
Comment #9
Crell CreditAttribution: Crell commented80 chars. :-( We can probably just drop everything after the comma.
We don't need to repeat this from the parent interface.
Er, no?
Just doc fixes, easy to address. Then we're good here.
Comment #10
Crell CreditAttribution: Crell commentedComment #11
fgmRerolled accordingly. Actually, there was an actual earlier bug : a reference to Title::CHECK_PLAIN without its namespace, so I added it too.
Comment #12
Crell CreditAttribution: Crell commentedUnless bot disapproves. Thanks, fgm!
Comment #16
fgmThe single test which fails on the bot passes on my machine, and does not seem related to the patch in any way. This looks like a bot fluke to me : can anyone triple check ? It was not possibly to check it on simplytest.me, because displaying the testing page eats more than the 256 MB allocated to test instances, even with the minimal profile.
Comment #18
Crell CreditAttribution: Crell commentedLooks like it passed again. Bot fluke.
Comment #19
catch#2352155: Remove HtmlFragment/HtmlPage will remove HtmlFragment/HtmlPage for now. Some of the concepts could be re-introduced in 8.1.x or later if we can find use cases. Moving to 8.1.x/postponed for now.
Comment #20
catchWhich is probably more likely to be baby steps towards #1843798: [meta] Refactor Render API to be OO.