Make WordPress Core

Opened 8 months ago

Closed 3 weeks ago

#61765 closed enhancement (fixed)

Twenty Twelve: The large quote pattern does not use a quote block

Reported by: poena's profile poena Owned by: poena's profile poena
Milestone: 6.8 Priority: low
Severity: normal Version:
Component: Bundled Theme Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

The pattern "Left-aligned Large Quote" does not insert a quote block. Instead, it inserts paragraphs, which is unexpected based on its name.

I suggest updating the blocks in the pattern and use a quote.

Attachments (14)

61765.diff (3.4 KB) - added by iflairwebtechnologies 8 months ago.
Review quote pattern issue
61765.patch (3.4 KB) - added by iflairwebtechnologies 8 months ago.
Review quote pattern issue here also attached patch file
SCR-20240727-kywa.png (201.4 KB) - added by karmatosed 8 months ago.
61765.2.patch (2.7 KB) - added by iflairwebtechnologies 8 months ago.
Revise updated code
61765.3.patch (3.7 KB) - added by iflairwebtechnologies 7 months ago.
61765.4.patch (1.8 KB) - added by wpeople 7 months ago.
Updated Patch
before patch.jpg (234.2 KB) - added by nithins53 6 months ago.
Before applying the patch
after patch.jpg (249.5 KB) - added by nithins53 6 months ago.
after applying the patch
Before patch.jpg (426.9 KB) - added by balub 6 months ago.
Before patch
After patch.jpg (455.4 KB) - added by balub 6 months ago.
After patch
61765.5.patch (1.8 KB) - added by itpathsolutions 7 weeks ago.
Updated Patch
before-patch-backend.png (70.8 KB) - added by shailu25 4 weeks ago.
Before Patch Backend
after-patch-backend.png (67.1 KB) - added by shailu25 4 weeks ago.
After Patch Backend
after-patch-frontend.png (75.4 KB) - added by shailu25 4 weeks ago.
After Patch Frontend

Download all attachments as: .zip

Change History (49)

#1 @poena
8 months ago

  • Keywords good-first-bug added

@iflairwebtechnologies
8 months ago

Review quote pattern issue

#2 @iflairwebtechnologies
8 months ago

Please review here 61765.diff the solved issue about Twenty Twelve: The large quote pattern does not use a quote block

@iflairwebtechnologies
8 months ago

Review quote pattern issue here also attached patch file

This ticket was mentioned in PR #7099 on WordPress/wordpress-develop by iflair.


8 months ago
#3

  • Keywords has-patch added

Fixes #61765 : Twenty Twelve The large quote pattern fix to use a quote block

#4 @karmatosed
8 months ago

  • Owner set to karmatosed
  • Status changed from new to assigned

#5 @karmatosed
8 months ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 6.7

Thank you everyone this makes sense to me. I am going to go ahead and test to see about getting this in.

#6 @karmatosed
8 months ago

Unfortunately in testing this patch ends up with blocks being unable to be recovered due to the changes. I would suggest more testing and looking at this @iflairwebtechnologies in your patch.

#7 @karmatosed
8 months ago

  • Keywords changes-requested added

#8 @karmatosed
8 months ago

  • Owner karmatosed deleted

@iflairwebtechnologies
8 months ago

Revise updated code

#9 @iflairwebtechnologies
8 months ago

@karmatosed
We have tested the code and also made changes in the code

#10 @shailu25
8 months ago

  • Keywords changes-requested removed

#11 @sabernhardt
8 months ago

  • Keywords changes-requested added; needs-testing removed

To replace blocks in a theme's pattern:

  1. Copy the content value from the block pattern PHP (and paste the code into a separate file).
  2. Activate the theme.
  3. Go to the editor and insert that pattern.
  4. Transform the block(s) to another block.
  5. Adjust block settings and/or markup, if appropriate. (With the Quote block in Twenty Twelve, the em tags are unnecessary because both the paragraph and citation are italicized.)
  6. Switch to Code view, and copy the new block(s).
  7. Paste that into the block pattern PHP, in the content value.
  8. Indent any new lines (with tabs).
  9. Replace any text with the translatable strings you copied in step 1.
  10. Return to the editor, and insert the updated pattern.
  11. Switch to Code view, and verify that the pattern matches what you made in steps 4 and 5.
			'content'       => '<!-- wp:quote -->
				<blockquote class="wp-block-quote"><!-- wp:paragraph {"style":{"typography":{"fontSize":"40px","lineHeight":1.5}}} -->
				<p style="font-size:40px;line-height:1.5"><strong>' . esc_html__( '"Few people are capable of expressing with equanimity opinions which differ from the prejudices of their social environment. Most people are even incapable of forming such opinions."', 'twentytwelve' ) . '</strong></p>
				<!-- /wp:paragraph --><cite>' . esc_html__( '—  Albert Einstein', 'twentytwelve' ) . '</cite></blockquote>
				<!-- /wp:quote -->',

The nested Paragraph block above could produce invalid/unexpected content errors in older versions of WordPress, though I think that is the best option.

  • Block patterns were introduced in WordPress 5.5.
  • Twenty Twelve added its patterns in #51105, at the same time as WordPress 5.8.
  • The Quote block started nesting a Paragraph block inside it in WordPress 6.1.

The comment also needs updating because the pattern does not have a heading. Suggestion:

// Quote with large paragraph text.
Last edited 6 months ago by sabernhardt (previous) (diff)

#12 @iflairwebtechnologies
7 months ago

@sabernhardt
You can review 61765.3.patch,
Uploaded a new patch here with updated changes

@wpeople
7 months ago

Updated Patch

#13 @wpeople
7 months ago

I have Updated Patch because there was an issue with cite text and also space is missing in inline comment

  • cite Text should be — Albert Einstein instead of ΓÇö Albert Einstein
  • Added Space in Inline Comment.
Last edited 7 months ago by wpeople (previous) (diff)

This ticket was mentioned in Slack in #core by chaion07. View the logs.


7 months ago

This ticket was mentioned in Slack in #core-themes by poena. View the logs.


6 months ago

This ticket was mentioned in Slack in #core by stoyangeorgiev. View the logs.


6 months ago

#17 @sabernhardt
6 months ago

  • Keywords needs-testing added; changes-requested removed

#18 @nithins53
6 months ago

I tested the 61765.4.patch and it works. Attaching images below for reference.

@nithins53
6 months ago

Before applying the patch

@nithins53
6 months ago

after applying the patch

#19 @balub
6 months ago

Patch 61765.4 was tested and the patch was working. Images of the tested patch are attached below.

@balub
6 months ago

Before patch

@balub
6 months ago

After patch

#20 @sabernhardt
6 months ago

61765.4.patch works for me in trunk, and I was also able to add the pattern in WordPress 6.1 and 6.2. I had the unexpected content error in 6.0, but that might not be a blocker.

I would like feedback from @poena before recommending for commit consideration. (With your limited time and higher priorities, this can be pushed to 6.8.)

#21 @davidbaumwald
6 months ago

  • Milestone changed from 6.7 to 6.8

Agree with @sabernhardt. With this being low prio, and most work focused on getting TT5 to the finish line in 6.7, let's move this to 6.8.

@poena If you or any other committer feels the remaining work can be resolved in time for Beta 1 and wishes to assume ownership, feel free to update the milestone accordingly.

#22 @sukhendu2002
3 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/61765/61765.4.patch

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.26
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.26)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twelve 4.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch.
  2. The "Left-aligned Large Quote" pattern now correctly inserts a quote block, aligning functionality with its name.

Supplemental Artifacts

Before: https://utfs.io/f/TTyF6MLuAyHDmHUe2d7cy0ML1dvzKaDCHngR4TXU9ulNPpbV
After: https://utfs.io/f/TTyF6MLuAyHDx6oAdzlWE8K7S6oCBbeO025dgyihRPMVXYkl

#23 @poena
2 months ago

Hi

I have a question before committing this change:
Patch 3 shows that there may be encoding issues with the em dash character in the pattern text. Patch 4 is correct, but should the em dash be replaced by the HTML entity &mdash; instead?

#24 @dilip2615
7 weeks ago

Hello @poena according to my thoughts,In the Twenty Twelve theme, the large quote pattern might be using a custom HTML structure or CSS styling instead of utilizing the native WordPress quote block (<blockquote>). This can affect the semantic structure and block editor consistency.

<?php
register_block_pattern(
    'twentytwelve/large-quote',
    array(
        'title'       => __( 'Large Quote', 'twentytwelve' ),
        'description' => __( 'A large quote using the quote block.', 'twentytwelve' ),
        'content'     => '<!-- wp:quote {"className":"large-quote"} -->
        <blockquote class="wp-block-quote large-quote">
            <p>' . esc_html__( 'This is a large quote example.', 'twentytwelve' ) . '</p>
            <cite>' . esc_html__( 'Author Name', 'twentytwelve' ) . '</cite>
        </blockquote>
        <!-- /wp:quote -->',
        'categories'  => array( 'text' ),
    )
);

after need to update bellow css

.large-quote {

font-size: 2em;
font-style: italic;
text-align: center;
border-left: 5px solid #ccc;
padding-left: 20px;

}

#25 follow-up: @poena
7 weeks ago

@dilip2615 perhaps there is a language issue but I did not understand what you are responding to.

There is already a working patch.
The patch has the styling including font size applied to the block.

What I was asking in comment 23 was if the em dash should be replaced by the HTML entity.

#26 @poena
7 weeks ago

I did not look through the CSS today (replying from my phone :) ). But I believe the intention is to keep any CSS the same so that the patterns that are already placed do not break or change design.

These patterns are not synced, patterns that are already placed do not have a connection to the new pattern code and will not be updated when the new code is added to the theme.

#27 in reply to: ↑ 25 @dilip2615
7 weeks ago

Replying to poena:Yes I know @poena,Thanks for the suggestion regarding modifying the pattern. However, the styling and block implementation are already addressed in the existing patch. My concern is whether the em dash (—) used in the quote should be replaced with the HTML entity (&mdash;). Could you confirm if it's necessary for consistency and best practices, or if the current usage is acceptable?

@dilip2615 perhaps there is a language issue but I did not understand what you are responding to.

There is already a working patch.
The patch has the styling including font size applied to the block.

What I was asking in comment 23 was if the em dash should be replaced by the HTML entity.

@itpathsolutions
7 weeks ago

Updated Patch

#28 @itpathsolutions
7 weeks ago

Updated Patch as Per suggested in this comment

#29 @poena
7 weeks ago

There are still language difficulties, I don't want to be rude but I am struggling to understand you.

I am asking the question, so I don't know why you are asking me to confirm and answer my own question...

#30 @shraddhagore
4 weeks ago

Patch report: https://core.trac.wordpress.org/attachment/ticket/61765/61765.5.patch

Environment:
WordPress: 6.8-alpha-59274-src
Theme: Twenty Twelve
Browser: Google Chrome
OS: Windows 11

Screenshots:
Before: https://prnt.sc/sxVzFnzKetdQ
After: https://prnt.sc/cwALkU0ENgRX

Comments:
The patch 5 is working as expected.

#31 @shailu25
4 weeks ago

Patch Tested: https://core.trac.wordpress.org/attachment/ticket/61765/61765.5.patch

Environment:

WordPress - 6.7.2
OS - Windows
Browser - Firefox
Theme: Twenty Twelve
PHP - 8.2.12

Actual Results:

  • Issue Resolved With Patch✅

@shailu25
4 weeks ago

Before Patch Backend

@shailu25
4 weeks ago

After Patch Backend

@shailu25
4 weeks ago

After Patch Frontend

#32 @ugyensupport
3 weeks ago

Twenty Twelve: The large quote pattern does not use a quote block

Description

The pattern "Left-aligned Large Quote" does not insert a quote block. Instead, it inserts paragraphs, which is unexpected based on its name.

I suggest updating the blocks in the pattern and use a quote.

Patch tested:
https://core.trac.wordpress.org/attachment/ticket/61765/61765.5.patch

Environment

  • WordPress: 6.7.3-alpha-59811
  • PHP: 8.4.1
  • Server: Apache/2.4.62 (Unix) mod_wsgi/5.0.1 Python/3.12 mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1w
  • Database: mysqli (Server: 5.7.44 / Client: mysqlnd 8.4.1)
  • Browser: Chrome 133.0.0.0
  • OS: macOS
  • Theme: Twenty Twelve 4.4
    • Test Reports 1.2.0


Actual Results

  1. ✅ Issue resolved with patch.

Supplemental Artifacts

Before: https://ibb.co/k2T6hFZj
After: https://ibb.co/nN7s1L7W

Last edited 3 weeks ago by ugyensupport (previous) (diff)

#33 @poena
3 weeks ago

  • Keywords commit added; needs-testing removed

#34 @poena
3 weeks ago

I acknowledge that this change will create a block validation error on some older WordPress versions when the pattern is inserted. The validation error can be resolved in the editor and I believe the impact is small.

#35 @poena
3 weeks ago

  • Owner set to poena
  • Resolution set to fixed
  • Status changed from assigned to closed

In 59842:

Twenty Twelve: Update the quote pattern to use the quote block.

This change updates the Left-aligned Large Quote pattern to use the quote block instead of
paragraph blocks.

Props flairwebtechnologies, sabernhardt, karmatosed, wpeople, poena, nithins53, balub, sukhendu2002, dilip2615, itpathsolutions, shraddhagore, shailu25.
Fixes #61765.

Note: See TracTickets for help on using tickets.