PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.4
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / bulk-editor / infrastructure / posts / post-title-trait.php

post-title-trait.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.4, at src/bulk-editor/infrastructure/posts/post-title-trait.php

31 lines 950 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4 namespace Yoast\WP\SEO\Bulk_Editor\Infrastructure\Posts;
5
6 /**
7 * Produces the display title shared by both post collectors.
8 */
9 trait Post_Title_Trait {
10
11 /**
12 * Returns the post title for display in the bulk editor.
13 *
14 * The `the_title` filter run by get_the_title() can return HTML-encoded entities; they are
15 * decoded so the React table renders them as text. An empty title falls back to WordPress' own
16 * untitled-post convention, so the table and its accessible names always have text content.
17 *
18 * @param int $post_id The post ID.
19 *
20 * @return string The display title.
21 */
22 protected function get_normalized_title( int $post_id ): string {
23 $title = \html_entity_decode( \get_the_title( $post_id ), \ENT_QUOTES, 'UTF-8' );
24 if ( $title === '' ) {
25 return \__( '(no title)', 'wordpress-seo' );
26 }
27
28 return $title;
29 }
30 }
31