Since it can't be accessed directly in the twig template it should be called format.label instead so that calls label() method.
Patch is provided.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vladan.me’s picture

Status: Active » Needs review
dawehner’s picture

Does that mean we need some test coverage for that? this is pretty tricky :)

dawehner’s picture

Do you maybe know whether we can ask twig to fail in case something like this happens and not just silently ignore it? (I guess this is what is happening).

Berdir’s picture

Issue tags: +Needs tests

We should be able to test this easily be checking for that markup on a page that prints this. We did find this because of w3c html validation, in fact ;)

I don't know how to do tell twig when to report and error and when not?

Berdir’s picture

Status: Needs review » Needs work
vladan.me’s picture

Assigned: Unassigned » vladan.me
vladan.me’s picture

Status: Needs work » Needs review
FileSize
772 bytes

Here's patch with tests only to prove that is missing labels.

vladan.me’s picture

Assigned: vladan.me » Unassigned
FileSize
1.21 KB

And full patch.

The last submitted patch, 7: format-name-2404673-7-tests.patch, failed testing.

Berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/filter/src/Tests/TextFormatElementFormTest.php
@@ -117,6 +117,10 @@ public function testTextFormatElement() {
+    $this->assertNoPattern('|<h4[^>]*></h4>|', 'Title in the H4 element is not found.');

Assertion message is a bit confusing, I'd suggest "No empty H4 element found".

Poornima3’s picture

Issue tags: +#dcdelhi
Poornima3’s picture

vladan.me’s picture

Status: Needs work » Needs review
FileSize
1.2 KB

Updated.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Thanks, this looks good to me. As mentioned, I don't really see how we could change anything in regards to how twig works.. that it doesn't give notices/errors is kind of a feature.

The only thing i can think of would be to given an explicit error if object.property not resolved into anything *and* it is a protected property. But that would also cost processing time.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Template changes are unfrozen in beta and this is fixing a bug. Committed c706fd7 and pushed to 8.0.x. Thanks!

  • alexpott committed c706fd7 on 8.0.x
    Issue #2404673 by vladan.me, Poornima3: Property format.name is now...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.