PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / src / admin / admin-filters-widgets-options.php

admin-filters-widgets-options.php in Polylang trunk, at src/admin/admin-filters-widgets-options.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 /**
7 * Class PLL_Widgets_Filters
8 *
9 * @since 3.0
10 *
11 * Adds new options to {@see https://developer.wordpress.org/reference/classes/wp_widget/ WP_Widget} and saves them.
12 */
13 class PLL_Admin_Filters_Widgets_Options extends PLL_Filters_Widgets_Options {
14 /**
15 * Modifies the widgets forms to add our language dropdown list.
16 *
17 * @since 0.3
18 * @since 3.0 Moved from PLL_Admin_Filters
19 *
20 * @param WP_Widget $widget Widget instance.
21 * @param null $return Not used.
22 * @param array $instance Widget settings.
23 * @return void
24 *
25 * @phpstan-param WP_Widget<array<string, mixed>> $widget
26 */
27 public function in_widget_form( $widget, $return, $instance ) {
28 $screen = get_current_screen();
29
30 // Test the Widgets screen and the Customizer to avoid displaying the option in page builders
31 // Saving the widget reloads the form. And curiously the action is in $_REQUEST but neither in $_POST, nor in $_GET.
32 if ( ( isset( $screen ) && 'widgets' === $screen->base ) || ( isset( $_REQUEST['action'] ) && 'save-widget' === $_REQUEST['action'] ) || isset( $GLOBALS['wp_customize'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
33 parent::in_widget_form( $widget, $return, $instance );
34 }
35 }
36 }
37