-
Notifications
You must be signed in to change notification settings - Fork 843
Jetpack Forms: cleanup dashboard migration code #43825
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
base: trunk
Are you sure you want to change the base?
Changes from 1 commit
0dc6936
84a5b97
4460246
437727c
d95d9a6
09e9276
1d728b8
5eaea44
d3a9f6a
b7d5dd6
0bf2756
9c7b5ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ed conditional code
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,32 +43,25 @@ public function is_jetpack_forms_admin_page() { | |
| * @deprecated 6.6.0 Use Dashboard::get_forms_admin_url() instead. | ||
| * | ||
| * @param string|null $tab Tab to open in the forms admin page. | ||
| * @param boolean $force_inbox Whether to force the inbox view URL. | ||
| * | ||
| * @return string | ||
| */ | ||
| public function get_forms_admin_url( $tab = null, $force_inbox = false ) { | ||
| public function get_forms_admin_url( $tab = null ) { | ||
| _deprecated_function( __METHOD__, 'jetpack-6.6.0', 'Dashboard::get_forms_admin_url' ); | ||
| $is_classic = $this->get_preferred_view() === self::CLASSIC_VIEW; | ||
| $switch_is_available = $this->is_jetpack_forms_view_switch_available(); | ||
| $base_url = get_admin_url() . 'admin.php?page=jetpack-forms-admin'; | ||
|
|
||
| $base_url = $is_classic && $switch_is_available && ! $force_inbox | ||
| ? get_admin_url() . 'edit.php?post_type=feedback' | ||
| : get_admin_url() . ( $this->is_jetpack_forms_admin_page_available() ? 'admin.php?page=jetpack-forms-admin' : 'admin.php?page=jetpack-forms' ); | ||
|
|
||
| return $this->append_tab_to_url( $base_url, $tab, $is_classic && $switch_is_available && ! $force_inbox ); | ||
| return self::append_tab_to_url( $base_url, $tab, false ); | ||
| } | ||
|
|
||
| /** | ||
| * Appends the appropriate tab parameter to the URL based on the view type. | ||
| * | ||
| * @param string $url Base URL to append to. | ||
| * @param string $tab Tab to open. | ||
| * @param boolean $is_classic_view Whether we're using the classic view. | ||
| * @param string $url Base URL to append to. | ||
| * @param string $tab Tab to open. | ||
| * | ||
| * @return string | ||
| */ | ||
| private function append_tab_to_url( $url, $tab, $is_classic_view ) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason to convert this to a static function? No big deal. Just curious. We should be sure we catch any other places the function is used (if relevant).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we don't want to be instancing the dashboard switch class when we don't need it, it's a simple mechanism. And previous changes remove the initial instantiation of the class, so there's no more a way to call it as a class method, only static. The same function exists on Dashboard class. The original idea was to delete the method (or the entire class), this is the safer approach. |
||
| private static function append_tab_to_url( $url, $tab ) { | ||
| if ( ! $tab ) { | ||
| return $url; | ||
| } | ||
|
|
@@ -83,9 +76,7 @@ private function append_tab_to_url( $url, $tab, $is_classic_view ) { | |
| return $url; | ||
| } | ||
|
|
||
| return $is_classic_view | ||
| ? add_query_arg( 'post_status', $status_map[ $tab ], $url ) | ||
| : $url . '#/responses?status=' . $status_map[ $tab ]; | ||
| return $url . '#/responses?status=' . $status_map[ $tab ]; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.