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

Fix automation workflows are fetched on every operation in WordPress #121

Merged
merged 1 commit into from
Nov 5, 2021
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
14 changes: 7 additions & 7 deletions includes/class-smaily-for-wp-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
class Smaily_For_WP_Widget extends WP_Widget {

/**
* Array of autoresponders.
* Admin model.
*
* @since 3.0.0
* @since 3.0.7
* @access private
* @var array $autoresponders Used to populate the autoresponder <select> field.
* @var Smaily_For_WP_Admin
*/
private $autoresponders;
private $admin_model;

/**
* Handler for storing/retrieving data via Options API.
Expand All @@ -37,8 +37,8 @@ public function __construct( Smaily_For_WP_Options $options, Smaily_For_WP_Admin
$widget_ops = array( 'description' => __( 'Smaily newsletter subscription form', 'smaily-for-wp' ) );
parent::__construct( 'smaily_subscription_widget', __( 'Smaily Newsletter Subscription', 'smaily-for-wp' ), $widget_ops );

$this->options = $options;
$this->autoresponders = $admin_model->get_autoresponders();
$this->options = $options;
$this->admin_model = $admin_model;
}

/**
Expand Down Expand Up @@ -197,7 +197,7 @@ public function form( $instance ) {
<label for="' . $autoresponder_id . '">' . esc_html__( 'Autoresponders', 'smaily-for-wp' ) . ':</label>
<select id="' . $autoresponder_id . '" name="' . $autoresponder . '">
<option value="">' . esc_html__( 'No autoresponder', 'smaily-for-wp' ) . '</option>';
foreach ( $this->autoresponders as $id => $title ) {
foreach ( $this->admin_model->get_autoresponders() as $id => $title ) {
echo '<option value="' . esc_attr( $id ) . '"' . selected( $instance['autoresponder'], $id, false ) . '>' . esc_attr( $title ) . '</option>';
}
echo '</select></p>';
Expand Down