Opened 13 days ago
Last modified 12 days ago
#63534 new enhancement
Add `link_to` label to post types
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | good-first-bug has-patch needs-test-info |
Focuses: | ui | Cc: |
Description
In order to fix the Gutenberg issue 55057, we think the best way would be to add a new label which could be used as it instead of using sprintf
<ToggleControl __nextHasNoMarginBottom label={ postType?.labels.singular_name ? sprintf( // translators: %s: Name of the post type e.g: "post". __( 'Link to %s' ), postType.labels.singular_name ) : __( 'Link to post' ) } onChange={ () => setAttributes( { isLink: ! isLink } ) } checked={ isLink } />
Change History (6)
This ticket was mentioned in PR #8910 on WordPress/wordpress-develop by @benoitchantre.
13 days ago
#2
- Keywords has-patch added; needs-patch removed
#3
follow-up:
↓ 4
@
13 days ago
Ciao, while reviewing this change, I noticed the array formatting is inconsistent (some entries inline, others multiline).
Is it generally acceptable to update the formatting for consistency when touching these arrays, or is it better to leave existing style unchanged unless it's directly related to the fix?
Just want to align with best practices.
#4
in reply to:
↑ 3
@
12 days ago
- Keywords needs-test-info added
@benoitchantre can you explain how this can be displayed or tested?
@ravigadhiyawp commented this during our patch testing session, the thing is after the patch I can't see anything changing with this patch (I was expecting the post/page not capitalized). I wondered if a newer version of Gutenberg is required for this to display or something.
For example after applying the patch, the Page is still capitalized:
Replying to riccardodicurti:
Ciao, while reviewing this change, I noticed the array formatting is inconsistent (some entries inline, others multiline).
Is it generally acceptable to update the formatting for consistency when touching these arrays, or is it better to leave existing style unchanged unless it's directly related to the fix?
Just want to align with best practices.
Generally you should pass the PHPCS. If the line is going to be too long with a single line, you have to move into multiline. You can go multiline if you wish. There is no real rule of thumb other than being PHPCS compliant.
Here as I run the PHPCS checker script:
$ vendor/bin/phpcs src/wp-includes/class-wp-post-type.php . 1 / 1 (100%)
No issues are found. A different thing will be if they use the short form of array like this:
'link_to_item' => [ _x( 'Link to post', 'editor control label' ), _x( 'Link to page', 'editor control label' ), ],
Then it will throw the PHPCS error, which is unnaccepted
FILE: src/wp-includes/class-wp-post-type.php -------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------------------------------- 1029 | ERROR | [x] Short array syntax is not allowed (Universal.Arrays.DisallowShortArraySyntax.Found) -------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY --------------------------------------------------------------------------------------------------------
#5
follow-up:
↓ 6
@
12 days ago
@SirLouen This ticket is a first step to fix the issue in Gutenberg. Once added to trunk (if approved), some changes will be needed in Gutenberg to close the Gutenberg issue.
#6
in reply to:
↑ 5
@
12 days ago
Replying to benoitchantre:
@SirLouen This ticket is a first step to fix the issue in Gutenberg. Once added to trunk (if approved), some changes will be needed in Gutenberg to close the Gutenberg issue.
Ok, this is what I was expecting, but maybe there was already the patch in Gutenberg to do the full testing (which I see it's not ready yet)
Trac ticket: https://core.trac.wordpress.org/ticket/63534