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

Remove support for background gradients #152

Merged
merged 5 commits into from
Apr 27, 2020
Merged
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
9 changes: 4 additions & 5 deletions includes/class-newspack-newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public static function instance() {
*/
public function __construct() {
add_action( 'the_post', [ __CLASS__, 'remove_other_editor_modifications' ] );
add_action( 'the_post', [ __CLASS__, 'disable_gradients' ] );
add_action( 'init', [ __CLASS__, 'register_cpt' ] );
add_action( 'init', [ __CLASS__, 'register_meta' ] );
add_action( 'enqueue_block_editor_assets', [ __CLASS__, 'enqueue_block_editor_assets' ] );
add_action( 'enqueue_block_editor_assets', [ __CLASS__, 'disable_gradients' ] );
add_action( 'rest_api_init', [ __CLASS__, 'rest_api_init' ] );
add_action( 'default_title', [ __CLASS__, 'default_title' ], 10, 2 );
add_action( 'save_post_' . self::NEWSPACK_NEWSLETTERS_CPT, [ __CLASS__, 'save_post' ], 10, 3 );
Expand Down Expand Up @@ -477,7 +477,7 @@ public static function api_set_campaign_settings( $request ) {

$verified_domains = array_filter(
array_map(
function( $domain ) {
function( $domain ) {
return $domain['verified'] ? strtolower( trim( $domain['domain'] ) ) : null;
},
$result['domains']
Expand Down Expand Up @@ -756,7 +756,7 @@ public static function retrieve_data( $id ) {
);
}
$mc = new Mailchimp( self::mailchimp_api_key() );
$campaign = self::validate_mailchimp_operation(
$campaign = self::validate_mailchimp_operation(
$mc->get( "campaigns/$mc_campaign_id" ),
__( 'Error retrieving Mailchimp campaign.', 'newspack_newsletters' )
);
Expand Down Expand Up @@ -958,8 +958,7 @@ public static function get_newsletter_templates() {
* Disable gradients in Newsletter CPT.
*/
public static function disable_gradients() {
$screen = get_current_screen();
if ( ! $screen || self::NEWSPACK_NEWSLETTERS_CPT !== $screen->post_type ) {
if ( self::NEWSPACK_NEWSLETTERS_CPT != get_post_type() ) {
return;
}
add_theme_support( 'editor-gradient-presets', array() );
Expand Down