-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor how actions are created
- Loading branch information
1 parent
31b5453
commit 004cdd4
Showing
6 changed files
with
207 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace EEF\Includes\Actions; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
class Register_Actions { | ||
/** | ||
* Actions | ||
*/ | ||
private array $actions; | ||
|
||
public function __construct( $actions ) { | ||
$this->actions = $actions; | ||
} | ||
|
||
public function set_hooks() : void { | ||
\add_action( 'elementor_pro/forms/actions/register', array( $this, 'register' ), -10 ); | ||
} | ||
|
||
/** | ||
* Register form acitons to be used after subumitting the form. | ||
* | ||
* @since 2.0 | ||
* @param ElementorPro\Modules\Forms\Registrars\Form_Actions_Registrar $form_actions_registrar | ||
*/ | ||
public function register( $form_actions_registrar ) : void { | ||
if ( empty( $this->actions ) ) { | ||
return; | ||
} | ||
|
||
foreach ( $this->actions as $action ) { | ||
include_once EEF_PLUGIN_PATH . $action['relative_path'] ?? ''; | ||
|
||
$class_name = 'EEF\Includes\Actions\\' . $action['class_name']; | ||
if ( class_exists( $class_name ) ) { | ||
$form_actions_registrar->register( new $class_name() ); | ||
} | ||
} | ||
} | ||
} |
106 changes: 0 additions & 106 deletions
106
includes/actions/class-register-post-fields-controls.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.