Skip to content

Conversation

youknowriad
Copy link
Contributor

closes #4042

This PR adds the enter_title_here to the editor's settings object and overrides the default title placeholder using this value.

Testing instructions

  • Add a filter like this
function change_title_text( $title ){
     return "my custom text";
}
  
add_filter( 'enter_title_here', 'change_title_text' );
  • Open Gutenberg and notice the title's placeholder displaying "my custom text"

@youknowriad youknowriad added the [Feature] Extensibility The ability to extend blocks or the editing experience label Dec 18, 2017
@youknowriad youknowriad self-assigned this Dec 18, 2017
@@ -116,7 +117,7 @@ class PostTitle extends Component {
className="editor-post-title__input"
value={ title }
onChange={ this.onChange }
placeholder={ __( 'Add title' ) }
placeholder={ placeholder || __( 'Add title' ) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to have a default value here? What if a plugin author picks to set an empty string as a placeholder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know :). My thinking was to make this optional in case we instantiate this editor client-side in the future.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had only one small concern. It might be a non-issue. Otherwise code-wise everything looks good 👍

@youknowriad youknowriad merged commit 6a287a4 into master Dec 18, 2017
@youknowriad youknowriad deleted the apply/title-placeholder-filter branch December 18, 2017 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect the 'enter_title_here' hook
2 participants