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 translations loading before the init hook #2866

Closed
wants to merge 3 commits into from
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
9 changes: 8 additions & 1 deletion includes/Admin/Settings_Screens/Advertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ class Advertise extends Abstract_Settings_Screen {
* @since 2.2.0
*/
public function __construct() {
$this->id = self::ID;
add_action( 'init', array( $this, 'initHook' ) );
}

/**
* Initializes this settings page's properties.
*/
public function initHook(): void {
$this->id = self::ID;
$this->label = __( 'Advertise', 'facebook-for-woocommerce' );
$this->title = __( 'Advertise', 'facebook-for-woocommerce' );
$this->documentation_url = 'https://woocommerce.com/document/facebook-for-woocommerce/#how-to-create-ads-on-facebook';
Expand Down
14 changes: 10 additions & 4 deletions includes/Admin/Settings_Screens/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,22 @@ class Connection extends Abstract_Settings_Screen {
* Connection constructor.
*/
public function __construct() {

$this->id = self::ID;
$this->label = __( 'Connection', 'facebook-for-woocommerce' );
$this->title = __( 'Connection', 'facebook-for-woocommerce' );
add_action( 'init', array( $this, 'initHook' ) );

add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );

add_action( 'admin_notices', array( $this, 'add_notices' ) );
}

/**
* Initializes this settings page's properties.
*/
public function initHook(): void {
$this->id = self::ID;
$this->label = __( 'Connection', 'facebook-for-woocommerce' );
$this->title = __( 'Connection', 'facebook-for-woocommerce' );
}


/**
* Adds admin notices.
Expand Down
7 changes: 7 additions & 0 deletions includes/Admin/Settings_Screens/Product_Sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class Product_Sets extends Abstract_Settings_Screen {
* Connection constructor.
*/
public function __construct() {
add_action( 'init', array( $this, 'initHook' ) );
}

/**
* Initializes this settings page's properties.
*/
public function initHook(): void {
$this->id = self::ID;
$this->label = __( 'Product sets', 'facebook-for-woocommerce' );
$this->title = __( 'Product sets', 'facebook-for-woocommerce' );
Expand Down
14 changes: 10 additions & 4 deletions includes/Admin/Settings_Screens/Product_Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,21 @@ class Product_Sync extends Abstract_Settings_Screen {
* Connection constructor.
*/
public function __construct() {
$this->id = self::ID;
$this->label = __( 'Product sync', 'facebook-for-woocommerce' );
$this->title = __( 'Product sync', 'facebook-for-woocommerce' );
$this->documentation_url = 'https://woocommerce.com/document/facebook-for-woocommerce/#product-sync-settings';
add_action( 'init', array( $this, 'initHook' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
add_action( 'woocommerce_admin_field_product_sync_title', array( $this, 'render_title' ) );
add_action( 'woocommerce_admin_field_product_sync_google_product_categories', array( $this, 'render_google_product_category_field' ) );
}

/**
* Initializes this settings page's properties.
*/
public function initHook(): void {
$this->id = self::ID;
$this->label = __( 'Product sync', 'facebook-for-woocommerce' );
$this->title = __( 'Product sync', 'facebook-for-woocommerce' );
$this->documentation_url = 'https://woocommerce.com/document/facebook-for-woocommerce/#product-sync-settings';
}

/**
* Enqueues the assets.
Expand Down