Automattic / Edit-Flow

WordPress plugin to accelerate your editorial workflow
https://editflow.org
358 stars 132 forks source link

Refactor custom status module views #736

Closed alecgeatches closed 5 months ago

alecgeatches commented 5 months ago

Description

This PR is currently based on @ingeniumed's work in https://github.com/Automattic/Edit-Flow/pull/734. Please review after that PR has been merged.


Some cleanup for the custom status module, as initial work to extend it. There were a few main changes:

  1. The print_configure_view() function had a lot of responsibilities, embedded HTML, and indentation. I moved the two HTML sections (configure page, edit status page) into separate view files and simplified the function.

  2. Fixed some PHPCS warnings from using $_GET and $_POST variables in print_configure_view() with some rewrites and some phpcs:ignores.

  3. Updated i18n functions to their escaped versions (_e()esc_html_e()) where appropriate.

  4. Moved one string (ef_confirm_delete_status_string) from an embeded <script> tag to wp_localize_script().

  5. Updated all array()s in the file to short syntax ([]). I did this automatically with PHP-CS-Fixer:

    php-cs-fixer fix modules/custom-status/custom-status.php --rules='{"array_syntax": {"syntax": "short"}}'
  6. A lot of whitespace alignment changes were automatically made by my editor.

Steps to Test

  1. Check out PR.
  2. Go to Admin -> Edit Flow -> Custom Statuses.
  3. Ensure adding and editing custom statuses works as expected.