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

Suggestion: Move the plugins.php GitHub icon to the auto-updates column #1049

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Git_Updater/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ public function get_update_url( $type, $action, $repo_name ) {
/**
* Add git host based icons.
*
* @hooked theme_row_meta
*
* @param array $links Row meta action links.
* @param string $file Plugin or theme file.
*
Expand All @@ -635,6 +637,25 @@ public function row_meta_icons( $links, $file ) {
return $links;
}

/**
* Append the GitHub icon to the auto-updates column text.
*
* @hooked plugin_auto_update_setting_html
* @see \WP_Plugins_List_Table::single_row()
*
* @param string $html The existing HTML for the plugins.php Automatic Updates column.
* @param string $file Plugin or theme file.
*
* @return string
*/
public function plugin_auto_update_setting_html( $html, $file ) {
$icon = $this->get_git_icon( $file, false );
if( is_null( $icon ) ) {
return $html;
}
return "{$html} | {$icon}";
}

/**
* Get git host based icon as an HTML img element.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Git_Updater/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function () {
add_filter( 'upgrader_source_selection', [ $this->base, 'upgrader_source_selection' ], 10, 4 );

// Add git host icons.
add_filter( 'plugin_row_meta', [ $this->base, 'row_meta_icons' ], 15, 2 );
add_filter( 'plugin_auto_update_setting_html', [ $this->base, 'plugin_auto_update_setting_html' ], 15, 2 );
add_filter( 'theme_row_meta', [ $this->base, 'row_meta_icons' ], 15, 2 );

// Check for deletion of cron event.
Expand Down