...
diff --git a/src/editor-controls/group-control-typography.md b/src/editor-controls/group-control-typography.md
index 1b569183..4ce6496b 100644
--- a/src/editor-controls/group-control-typography.md
+++ b/src/editor-controls/group-control-typography.md
@@ -51,7 +51,7 @@ When using this group control, the `type` should be set to `Group_Control_Typogr
start_controls_section(
'content_section',
@@ -73,7 +73,7 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
}
- protected function render() {
+ protected function render(): void {
$settings = $this->get_settings_for_display();
?>
@@ -82,7 +82,7 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
...
diff --git a/src/editor-controls/group-control.md b/src/editor-controls/group-control.md
index 775473b4..56f0257d 100644
--- a/src/editor-controls/group-control.md
+++ b/src/editor-controls/group-control.md
@@ -34,7 +34,7 @@ When adding titles and custom content to Elementor widgets, we need to allow the
```php {13-19}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'style_section',
@@ -66,7 +66,7 @@ Border control is a bit different from typography control. It is defined in the
```php {13-19}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'style_section',
diff --git a/src/editor-controls/regular-control.md b/src/editor-controls/regular-control.md
index bdf960d7..ce6988ee 100644
--- a/src/editor-controls/regular-control.md
+++ b/src/editor-controls/regular-control.md
@@ -34,7 +34,7 @@ In the example below, we're going to add a simple text control defined at the `c
```php {13-20}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -67,7 +67,7 @@ In the example below, we're going to add a simple number control defined at the
```php {13-24}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -104,7 +104,7 @@ Another simple example is the `Control_Select` class, which will allow users to
```php {13-25}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -142,7 +142,7 @@ Choose control is an improved version of select control. The `Control_Choose` cl
```php {13-34}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -189,7 +189,7 @@ Another useful control is the `Control_Slider`, which displays a draggable range
```php {13-30}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -232,7 +232,7 @@ One of the more more popular controls is `Control_Color`, which lets users choos
```php {13-20}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
@@ -265,7 +265,7 @@ And finally, for advanced users, you can use `Control_Media` to select images fr
```php {13-22}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'content_section',
diff --git a/src/editor-controls/responsive-control.md b/src/editor-controls/responsive-control.md
index d2558508..5bb04fe3 100644
--- a/src/editor-controls/responsive-control.md
+++ b/src/editor-controls/responsive-control.md
@@ -34,7 +34,7 @@ The regular slider control defined in `Control_Slider` adds a draggable range sl
```php {13-41}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'style_section',
@@ -88,7 +88,7 @@ Another handy control is the dimensions control, defined in `Control_Dimensions`
```php {13-23}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'style_section',
@@ -124,7 +124,7 @@ Finally, we are going to use the select/choose control, which is defined in `Con
```php {13-35}
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section(
'style_section',
diff --git a/src/editor-controls/using-controls.md b/src/editor-controls/using-controls.md
index 4ba72690..908879d1 100644
--- a/src/editor-controls/using-controls.md
+++ b/src/editor-controls/using-controls.md
@@ -11,7 +11,7 @@ In your widget class, you can add controls inside the `register_controls()` meth
```php
class Elementor_Test_Widget extends \Elementor\Widget_Base {
- protected function register_controls() {
+ protected function register_controls(): void {
$this->start_controls_section();
diff --git a/src/finder/add-new-finder-items.md b/src/finder/add-new-finder-items.md
index eff2b49f..58d96f90 100644
--- a/src/finder/add-new-finder-items.md
+++ b/src/finder/add-new-finder-items.md
@@ -11,15 +11,15 @@ Finder categories include all the category labels and their items.
```php
class New_Finder_Category extends \Elementor\Core\Common\Modules\Finder\Base_Category {
- public function get_id() {
+ public function get_id(): string {
return 'my-category-name';
}
- public function get_title() {
+ public function get_title(): string {
return esc_html__( 'Category Label', 'textdomain' );
}
- public function get_category_items( array $options = [] ) {
+ public function get_category_items( array $options = [] ): array {
return [
'elementor-website' => [
'title' => esc_html__( 'Elementor', 'textdomain' ),
diff --git a/src/finder/advanced-example.md b/src/finder/advanced-example.md
index 1d17c365..39f46bf4 100644
--- a/src/finder/advanced-example.md
+++ b/src/finder/advanced-example.md
@@ -82,7 +82,7 @@ class Elementor_Finder_WordPress_Settings extends \Elementor\Core\Common\Modules
* @access public
* @return string Finder category id.
*/
- public function get_id() {
+ public function get_id(): string {
return 'wordpress-settings';
}
@@ -93,7 +93,7 @@ class Elementor_Finder_WordPress_Settings extends \Elementor\Core\Common\Modules
* @access public
* @return string Finder category title.
*/
- public function get_title() {
+ public function get_title(): string {
return esc_html__( 'WordPress Settings', 'elementor-finder-wordpress-settings' );
}
@@ -105,7 +105,7 @@ class Elementor_Finder_WordPress_Settings extends \Elementor\Core\Common\Modules
* @param array $options
* @return array An array of category items.
*/
- public function get_category_items( array $options = [] ) {
+ public function get_category_items( array $options = [] ): array {
return [
'general' => [
'title' => esc_html__( 'General', 'elementor-finder-wordpress-settings' ),
diff --git a/src/finder/finder-structure.md b/src/finder/finder-structure.md
index 1397b397..430d10b9 100644
--- a/src/finder/finder-structure.md
+++ b/src/finder/finder-structure.md
@@ -20,13 +20,13 @@ The extended class will have the following methods:
```php
class New_Finder_Category extends \Elementor\Core\Common\Modules\Finder\Base_Category {
- public function get_id() {}
+ public function get_id(): string {}
- public function get_title() {}
+ public function get_title(): string {}
- public function get_category_items() {}
+ public function get_category_items(): array {}
- public function is_dynamic() {}
+ public function is_dynamic(): bool {}
}
```
diff --git a/src/finder/simple-example.md b/src/finder/simple-example.md
index 0edf6219..30f93fa3 100644
--- a/src/finder/simple-example.md
+++ b/src/finder/simple-example.md
@@ -82,7 +82,7 @@ class Elementor_Finder_Social_Media extends \Elementor\Core\Common\Modules\Finde
* @access public
* @return string Finder category id.
*/
- public function get_id() {
+ public function get_id(): string {
return 'social-media';
}
@@ -93,7 +93,7 @@ class Elementor_Finder_Social_Media extends \Elementor\Core\Common\Modules\Finde
* @access public
* @return string Finder category title.
*/
- public function get_title() {
+ public function get_title(): string {
return esc_html__( 'Social Media Websites', 'elementor-finder-social-media' );
}
@@ -105,7 +105,7 @@ class Elementor_Finder_Social_Media extends \Elementor\Core\Common\Modules\Finde
* @param array $options
* @return array An array of category items.
*/
- public function get_category_items( array $options = [] ) {
+ public function get_category_items( array $options = [] ): array {
return [
'facebook' => [
'title' => esc_html__( 'Facebook', 'elementor-finder-social-media' ),
diff --git a/src/form-actions/action-controls.md b/src/form-actions/action-controls.md
index 9393c9a6..c0436ef1 100644
--- a/src/form-actions/action-controls.md
+++ b/src/form-actions/action-controls.md
@@ -11,7 +11,7 @@ In your action class, you can add controls using the `register_settings_section(
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- protected function register_settings_section( $widget ) {
+ protected function register_settings_section( $widget ): void {
$widget->start_controls_section();
@@ -37,7 +37,7 @@ In the example below, we're going to add a few controls to the widget instance t
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function register_settings_section( $widget ) {
+ public function register_settings_section( $widget ): void {
$widget->start_controls_section(
'custom_action_section',
diff --git a/src/form-actions/action-data.md b/src/form-actions/action-data.md
index 4966e8ab..e0adc33f 100644
--- a/src/form-actions/action-data.md
+++ b/src/form-actions/action-data.md
@@ -11,11 +11,11 @@ Action data needs to be "returned" by certain methods. Those methods are simple:
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function get_name() {
+ public function get_name(): string {
return 'action_name';
}
- public function get_label() {
+ public function get_label(): string {
return esc_html__( 'My Action Name', 'textdomain' );
}
diff --git a/src/form-actions/action-on-export.md b/src/form-actions/action-on-export.md
index e2223c06..bed70b7b 100644
--- a/src/form-actions/action-on-export.md
+++ b/src/form-actions/action-on-export.md
@@ -11,7 +11,7 @@ The method that excludes data from the export process is called `on_export()`. T
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function on_export( $element ) {
+ public function on_export( $element ): array {
return $element;
@@ -29,7 +29,7 @@ In the following example will register a new section with two controls - an api
```php {16,24,35-44}
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function register_settings_section( $widget ) {
+ public function register_settings_section( $widget ): void {
$widget->start_controls_section(
'custom_action_section',
@@ -61,7 +61,7 @@ class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_B
}
- public function on_export( $element ) {
+ public function on_export( $element ): array {
unset(
$element['custom_action_api_key'],
diff --git a/src/form-actions/action-run.md b/src/form-actions/action-run.md
index 0aca05b9..1fbbf5f1 100644
--- a/src/form-actions/action-run.md
+++ b/src/form-actions/action-run.md
@@ -11,7 +11,7 @@ The method that triggers the action is called `run()`. The method is executed on
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
// ...
@@ -33,7 +33,7 @@ In the example below, we'll send an email each time a form is submitted:
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
wp_mail( /* ... */ );
@@ -49,7 +49,7 @@ In the following example we'll send an HTTP request every time a form is submitt
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
wp_remote_post( /* ... */ )
@@ -65,7 +65,7 @@ Another use case is to create WordPress CPTs after every form submission:
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
wp_insert_post( /* ... */ );
diff --git a/src/form-actions/action-structure.md b/src/form-actions/action-structure.md
index 9c02f1d5..de5fb660 100644
--- a/src/form-actions/action-structure.md
+++ b/src/form-actions/action-structure.md
@@ -22,15 +22,15 @@ As mentioned above, an Elementor Form Action extends the `\ElementorPro\Modules\
```php
class Elementor_Test_Action extends \ElementorPro\Modules\Forms\Classes\Action_Base {
- public function get_name() {}
+ public function get_name(): string {}
- public function get_label() {}
+ public function get_label(): string {}
- public function register_settings_section( $widget ) {}
+ public function register_settings_section( $widget ): void {}
- public function run( $record, $ajax_handler ) {}
+ public function run( $record, $ajax_handler ): void {}
- public function on_export( $element ) {}
+ public function on_export( $element ): array {}
}
```
diff --git a/src/form-actions/advanced-example.md b/src/form-actions/advanced-example.md
index d3d13e3b..59c36af1 100644
--- a/src/form-actions/advanced-example.md
+++ b/src/form-actions/advanced-example.md
@@ -84,7 +84,7 @@ class Sendy_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Acti
* @access public
* @return string
*/
- public function get_name() {
+ public function get_name(): string {
return 'sendy';
}
@@ -97,7 +97,7 @@ class Sendy_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Acti
* @access public
* @return string
*/
- public function get_label() {
+ public function get_label(): string {
return esc_html__( 'Sendy', 'elementor-forms-sendy-action' );
}
@@ -110,7 +110,7 @@ class Sendy_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Acti
* @access public
* @param \Elementor\Widget_Base $widget
*/
- public function register_settings_section( $widget ) {
+ public function register_settings_section( $widget ): void {
$widget->start_controls_section(
'section_sendy',
@@ -171,7 +171,7 @@ class Sendy_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Acti
* @param \ElementorPro\Modules\Forms\Classes\Form_Record $record
* @param \ElementorPro\Modules\Forms\Classes\Ajax_Handler $ajax_handler
*/
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
$settings = $record->get( 'form_settings' );
@@ -236,7 +236,7 @@ class Sendy_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Acti
* @access public
* @param array $element
*/
- public function on_export( $element ) {
+ public function on_export( $element ): array {
unset(
$element['sendy_url'],
diff --git a/src/form-actions/simple-example.md b/src/form-actions/simple-example.md
index e6a30191..394a4acc 100644
--- a/src/form-actions/simple-example.md
+++ b/src/form-actions/simple-example.md
@@ -85,7 +85,7 @@ class Ping_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Actio
* @access public
* @return string
*/
- public function get_name() {
+ public function get_name(): string {
return 'ping';
}
@@ -98,7 +98,7 @@ class Ping_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Actio
* @access public
* @return string
*/
- public function get_label() {
+ public function get_label(): string {
return esc_html__( 'Ping', 'elementor-forms-ping-action' );
}
@@ -112,7 +112,7 @@ class Ping_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Actio
* @param \ElementorPro\Modules\Forms\Classes\Form_Record $record
* @param \ElementorPro\Modules\Forms\Classes\Ajax_Handler $ajax_handler
*/
- public function run( $record, $ajax_handler ) {
+ public function run( $record, $ajax_handler ): void {
wp_remote_post(
'https://api.example.com/',
@@ -141,7 +141,7 @@ class Ping_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Actio
* @access public
* @param \Elementor\Widget_Base $widget
*/
- public function register_settings_section( $widget ) {}
+ public function register_settings_section( $widget ): void {}
/**
* On export.
@@ -152,7 +152,7 @@ class Ping_Action_After_Submit extends \ElementorPro\Modules\Forms\Classes\Actio
* @access public
* @param array $element
*/
- public function on_export( $element ) {}
+ public function on_export( $element ): array {}
}
```
diff --git a/src/form-fields/advanced-example.md b/src/form-fields/advanced-example.md
index e7e7b3a5..0bff0a19 100644
--- a/src/form-fields/advanced-example.md
+++ b/src/form-fields/advanced-example.md
@@ -84,7 +84,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @access public
* @return string Field type.
*/
- public function get_type() {
+ public function get_type(): string {
return 'credit-card-number';
}
@@ -97,7 +97,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @access public
* @return string Field name.
*/
- public function get_name() {
+ public function get_name(): string {
return esc_html__( 'Credit Card Number', 'elementor-form-credit-card-number-field' );
}
@@ -113,7 +113,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @param mixed $form
* @return void
*/
- public function render( $item, $item_index, $form ) {
+ public function render( $item, $item_index, $form ): void {
$form_id = $form->get_id();
$form->add_render_attribute(
@@ -145,7 +145,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @param \ElementorPro\Modules\Forms\Classes\Ajax_Handler $ajax_handler
* @return void
*/
- public function validation( $field, $record, $ajax_handler ) {
+ public function validation( $field, $record, $ajax_handler ): void {
if ( empty( $field['value'] ) ) {
return;
}
@@ -168,7 +168,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @param \Elementor\Widget_Base $widget The form widget instance.
* @return void
*/
- public function update_controls( $widget ) {
+ public function update_controls( $widget ): void {
$elementor = \ElementorPro\Plugin::elementor();
$control_data = $elementor->controls_manager->get_control_from_stack( $widget->get_unique_name(), 'form_fields' );
@@ -223,7 +223,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @access public
* @return void
*/
- public function editor_preview_footer() {
+ public function editor_preview_footer(): void {
add_action( 'wp_footer', [ $this, 'content_template_script' ] );
}
@@ -236,7 +236,7 @@ class Elementor_Credit_Card_Number_Field extends \ElementorPro\Modules\Forms\Fie
* @access public
* @return void
*/
- public function content_template_script() {
+ public function content_template_script(): void {
?>