-
Notifications
You must be signed in to change notification settings - Fork 382
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
1360 Admin amp_invalid_url table - replace 'trash' text #1408
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
667784a
1360 Admin amp_invalid_url table - replace 'trash' text
johnwatkins0 81a03f1
amp_invalid_url post type 'Trash' text updates
johnwatkins0 636b20d
Update amp_invalid_url not_found_in_trash text
johnwatkins0 da59988
Resolve failing test
johnwatkins0 e4c4f4b
amp_invalid_url edit table text updates
johnwatkins0 fde8df2
amp_invalid_url post type text updates -- unit tests.
johnwatkins0 4bf6713
amp_invalid_url post type text updates -- PHPCS.
johnwatkins0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,8 @@ public static function add_admin_hooks() { | |
add_action( 'admin_action_' . self::VALIDATE_ACTION, array( __CLASS__, 'handle_validate_request' ) ); | ||
add_action( 'post_action_' . self::UPDATE_POST_TERM_STATUS_ACTION, array( __CLASS__, 'handle_validation_error_status_update' ) ); | ||
add_action( 'admin_menu', array( __CLASS__, 'add_admin_menu_new_invalid_url_count' ) ); | ||
add_filter( 'post_row_actions', array( __CLASS__, 'filter_post_row_actions' ), 10, 2 ); | ||
add_filter( sprintf( 'views_edit-%s', self::POST_TYPE_SLUG ), array( __CLASS__, 'filter_table_views' ) ); | ||
|
||
// Hide irrelevant "published" label in the invalid URL post list. | ||
add_filter( 'post_date_column_status', function( $status, $post ) { | ||
|
@@ -1493,4 +1495,42 @@ public static function print_dashboard_glance_styles() { | |
<?php | ||
} | ||
|
||
/** | ||
* Filters post row actions. | ||
* | ||
* @param array $actions Row action links. | ||
* @param \WP_Post $post Current WP post. | ||
* @return array Filtered action links. | ||
*/ | ||
public static function filter_post_row_actions( $actions, $post ) { | ||
// Replace 'Trash' text with 'Forget'. | ||
if ( isset( $actions['trash'] ) ) { | ||
$actions['trash'] = sprintf( | ||
'<a href="%s" class="submitdelete" aria-label="%s">%s</a>', | ||
get_delete_post_link( $post->ID ), | ||
/* translators: %s: post title */ | ||
esc_attr( sprintf( __( 'Forget “%s”', 'amp' ), $post->post_title ) ), | ||
__( 'Forget', 'amp' ) | ||
); | ||
} | ||
|
||
return $actions; | ||
} | ||
|
||
/** | ||
* Filters table views for the post type. | ||
* | ||
* @param array $views Array of table view links keyed by status slug. | ||
* @return array Filtered views. | ||
*/ | ||
public static function filter_table_views( $views ) { | ||
// Replace 'Trash' text with 'Forgotten'. | ||
if ( isset( $views['trash'] ) ) { | ||
$status = get_post_status_object( 'trash' ); | ||
|
||
$views['trash'] = str_replace( $status->label, __( 'Forgotten', 'amp' ), $views['trash'] ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to use |
||
} | ||
return $views; | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
esc_html__()
instead of__()