Skip to content

Commit

Permalink
Deprecate actions
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarssanchez committed Sep 22, 2022
1 parent 9158805 commit ff0df76
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
8 changes: 4 additions & 4 deletions developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ While the plugin itself will function on a local or firewalled machine, some ope

The brightcove plugin uses these hooks internally when rendering out plugin pages. Developers can add content via these hooks, augmenting the existing admin pages.

* `brightcove/admin/settings_page`: Fires when the setting page loads.
* `brightcove/admin/videos_page`: Fires when the videos page loads.
* `brightcove/admin/playlists_page`: Fires when the playlist page loads.
* `brightcove/admin/edit_source_page`: Fires when the edit source page loads.
* `brightcove_admin_settings_page`: Fires when the setting page loads.
* `brightcove_admin_videos_page`: Fires when the videos page loads.
* `brightcove_admin_playlists_page`: Fires when the playlist page loads.
* `brightcove_admin_edit_source_page`: Fires when the edit source page loads.

## JavaScript architecture

Expand Down
4 changes: 2 additions & 2 deletions includes/admin/class-bc-admin-labels-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class BC_Admin_Labels_Page {
public function __construct() {
$this->bc_labels = new BC_Labels();

add_action( 'brightcove/admin/labels_page', array( $this, 'render_labels_page' ) );
add_action( 'brightcove/admin/edit_label_page', array( $this, 'render_edit_label_page' ) );
add_action( 'brightcove_admin_labels_page', array( $this, 'render_labels_page' ) );
add_action( 'brightcove_admin_edit_label_page', array( $this, 'render_edit_label_page' ) );
}

/**
Expand Down
18 changes: 12 additions & 6 deletions includes/admin/class-bc-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function render_settings_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/settings_page' ); // phpcs:ignore
do_action_deprecated( 'brightcove/admin/settings_page', [], '2.7.1' );
do_action( 'brightcove_admin_settings_page' );
}

/**
Expand All @@ -81,7 +82,8 @@ public function render_labels_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/labels_page' ); // phpcs:ignore
do_action_deprecated( 'brightcove/admin/labels_page', [], '2.7.1' );
do_action( 'brightcove_admin_labels_page' );
}

/**
Expand All @@ -93,7 +95,8 @@ public function render_videos_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/videos_page' ); // phpcs:ignore
do_action_deprecated( 'brightcove/admin/videos_page', [], '2.7.1' );
do_action( 'brightcove_admin_videos_page' );
}

/**
Expand All @@ -105,7 +108,8 @@ public function render_playlists_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/playlists_page' ); // phpcs:ignore
do_action_deprecated( 'brightcove/admin/playlists_page', [], '2.7.1' );
do_action( 'brightcove_admin_playlists_page' );
}

/**
Expand All @@ -117,7 +121,8 @@ public function render_edit_source_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/edit_source_page' ); // phpcs:ignore
do_action_deprecated( 'brightcove/admin/edit_source_page', [], '2.7.1' );
do_action( 'brightcove_admin_edit_source_page' );
}

/**
Expand All @@ -129,7 +134,8 @@ public function render_edit_label_page() {
*
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility.
*/
do_action( 'brightcove/admin/edit_label_page' );// // phpcs:ignore
do_action_deprecated( 'brightcove/admin/edit_label_page', [], '2.7.1' );
do_action( 'brightcove_admin_edit_label_page' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-bc-admin-playlists-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BC_Admin_Playlists_Page {
* Constructor method
*/
public function __construct() {
add_action( 'brightcove/admin/playlists_page', array( $this, 'render' ) );
add_action( 'brightcove_admin_playlists_page', array( $this, 'render' ) );
add_action( 'admin_notices', array( $this, 'validate_players' ) );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-bc-admin-settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BC_Admin_Settings_Page {
*/
public function __construct() {
add_action( 'admin_init', array( $this, 'admin_init_settings' ) );
add_action( 'brightcove/admin/settings_page', array( $this, 'render' ) );
add_action( 'brightcove_admin_settings_page', array( $this, 'render' ) );
add_action( 'admin_init', array( $this, 'delete_source' ) );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-bc-admin-sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct() {

$this->notices = array();

add_action( 'brightcove/admin/edit_source_page', array( $this, 'render' ) );
add_action( 'brightcove_admin_edit_source_page', array( $this, 'render' ) );
add_action( 'admin_init', array( $this, 'save_account' ), 1 ); // Avoid a race condition where the account doesn't get saved properly.
add_action( 'admin_notices', array( $this, 'admin_notice_handler' ) );

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-bc-admin-videos-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BC_Admin_Videos_Page {
* Constructor method.
*/
public function __construct() {
add_action( 'brightcove/admin/videos_page', array( $this, 'render' ) );
add_action( 'brightcove_admin_videos_page', array( $this, 'render' ) );
add_action( 'current_screen', array( $this, 'verify_source_configuration' ) );
}

Expand Down

0 comments on commit ff0df76

Please sign in to comment.