Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Improvement #8074

Closed
NenadObradovic opened this issue Jul 20, 2018 · 3 comments
Closed

Plugin Improvement #8074

NenadObradovic opened this issue Jul 20, 2018 · 3 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@NenadObradovic
Copy link

Hi Guys,

I have few suggestions:

  1. Inside main plugin file gutenberg.php could you set these labels to be translatable?
    add_menu_page( 'Gutenberg', 'Gutenberg', 'edit_posts', 'gutenberg', 'the_gutenberg_project', 'dashicons-edit' );
    to be
    add_menu_page( __( 'Gutenberg', 'gutenberg' ), __( 'Gutenberg', 'gutenberg' ), 'edit_posts', 'gutenberg', 'the_gutenberg_project', 'dashicons-edit' );

  2. Inside same file, I think better solution is to split code from text
    echo __( 'Gutenberg development mode requires files to be built. Run <code>npm install</code> to install dependencies, <code>npm run build</code> to build the files or <code>npm run dev</code> to build the files and watch for changes. Read the <a href="https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md">contributing</a> file for more information.', 'gutenberg' );
    to be
    echo sprintf( __( 'Gutenberg development mode requires files to be built. Run %s to install dependencies, %s to build the files or %s to build the files and watch for changes. Read the %s file for more information.', 'gutenberg' ), '<code>' . __( 'npm install', 'gutenberg' ) . '</code>', '<code>' . __( 'npm run build', 'gutenberg' ) . '</code>', '<code>' . __( 'npm run dev', 'gutenberg' ) . '</code>', '<a href="https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md">' . __( 'contributing', 'gutenberg' ) . '</a>' );

  3. Inside blocks.php file what you think to add filter hooks on several places where you return the value so developer can easily hooks your functions and modify for their purpose.

  4. Inside meta-box-partial-page.php I think you can escape the plugin name, because some plugin can cause error if they have special character
    printf( __( 'Gutenberg incompatible meta box, from the "%s" plugin.', 'gutenberg' ), $plugin['Name'] );
    for example to be
    printf( __( 'Gutenberg incompatible meta box, from the "%s" plugin.', 'gutenberg' ), esc_attr( $plugin['Name'] ) );

  5. I read several posts about incorrect order of hooks admin_enqueue_scripts and add_meta_boxes when gutenberg plugin is active, so I wonder if it will stay in reverse order or your working on that to find solution to set these actions in the default order? Because if it's stay I think it will be cool that you fill some notice or add in documentation as FAQ so that developers could add a conditional in their project when plugin is active to change order of inclusion.

In my case I have some function which dynamically register meta boxes and if my meta boxes exist at the end of that function I called admin_enqueue_scripts hook to include dynamically corresponding style for it, because of this situation scripts are not loaded.

Nenad

@designsimply designsimply added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Jul 20, 2018
@pento
Copy link
Member

pento commented Jul 23, 2018

Thank you for the feedback, @NenadObradovic!

  1. Agreed, we can make this change.

  2. Agreed, this needs to be tweaking. The commands don't need to be translatable, so it would look more like this:

sprintf( __( 'Gutenberg development mode requires files to be built. Run %1$s to install dependencies, %2$s to build the files or %$3s to build the files and watch for changes. Read the <a href="%$4s">contributing</a> file for more information.', 'gutenberg' ), '<code>npm install</code>', '<code>npm run build</code>', '<code>npm run dev</code>', 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md">' );

  1. Could you please create a new issue, describing the filters you'd like to see, and your use cases for them? We're always happy to add new filters, but it's important for there to be a practical reason for them.

  2. We don't need to escape the name of installed plugins: the name ultimately comes from get_plugin_data(), which removes any invalid HTML. As the name is being used as HTML text (not as an attribute), no further escaping is needed. This is the same behaviour as WordPress Core uses when displaying the plugin page.

  3. Could you please create a new issue with a code example of how you're registering meta boxes and scripts? This would be super helpful in diagnosing the best way to ensure your code continues to work.

@NenadObradovic
Copy link
Author

Hi Pento,

You are welcome :)

3 and 5. I created a new tickets for these suggestions.

Best regards,
Nenad

@youknowriad
Copy link
Contributor

Looks like this has already been split into separate issues. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

4 participants