| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace WPDeveloper\BetterDocs\Editors\Elementor; |
| 4 | - | |
| 5 | 4 | use Elementor\Widget_Base; |
| 6 | 5 | use WPDeveloper\BetterDocs\Traits\EditorHelper; |
| 7 | 6 | |
| 8 | 7 | /** |
| @@ -8,49 +7,45 @@ | ||
| 8 | 7 | /** |
| 9 | 8 | * @method render_editor_script() |
| 10 | 9 | */ |
| 11 | 10 | abstract class BaseWidget extends Widget_Base { |
| 12 | - use EditorHelper; | |
| 11 | + use EditorHelper; | |
| 13 | 12 | |
| 14 | - public function __construct( $data = [], $args = null ) { | |
| 15 | - // $is_type_instance = $this->is_type_instance(); | |
| 16 | - // dump( $is_type_instance, $data, $args ); | |
| 13 | + public function __construct( $data = [], $args = null ) { | |
| 14 | + // $is_type_instance = $this->is_type_instance(); | |
| 15 | + // dump( $is_type_instance, $data, $args ); | |
| 17 | 16 | |
| 18 | - // if( $is_type_instance && $args !== null ) { | |
| 19 | - // $data['settings']['nested_posts_per_page'] = 5; | |
| 20 | - // } | |
| 17 | + // if( $is_type_instance && $args !== null ) { | |
| 18 | + // $data['settings']['nested_posts_per_page'] = 5; | |
| 19 | + // } | |
| 21 | 20 | |
| 22 | 21 | parent::__construct( $data, $args ); |
| 23 | 22 | |
| 24 | - // if( $is_type_instance && $args !== null ) { | |
| 25 | - // // $this->set_settings('nested_posts_per_page', 5); | |
| 26 | - // // $this->query = betterdocs()->query; | |
| 27 | - // } | |
| 28 | - } | |
| 23 | + // if( $is_type_instance && $args !== null ) { | |
| 24 | + // // $this->set_settings('nested_posts_per_page', 5); | |
| 25 | + // // $this->query = betterdocs()->query; | |
| 26 | + // } | |
| 27 | + } | |
| 29 | 28 | |
| 30 | - public function has_widget_inner_wrapper():bool { | |
| 31 | - return false; | |
| 32 | - } | |
| 29 | + public function betterdocs_do_action(){ | |
| 30 | + /** | |
| 31 | + * Query Controls! | |
| 32 | + * @source includes/elementor-helper.php | |
| 33 | + */ | |
| 34 | + do_action( 'betterdocs/elementor/widgets/query', $this, 'doc_category' ); | |
| 35 | + } | |
| 33 | 36 | |
| 34 | - public function betterdocs_do_action() { | |
| 35 | - /** | |
| 36 | - * Query Controls! | |
| 37 | - * @source includes/elementor-helper.php | |
| 38 | - */ | |
| 39 | - do_action( 'betterdocs/elementor/widgets/query', $this, 'doc_category' ); | |
| 40 | - } | |
| 37 | + abstract protected function render_callback(); | |
| 41 | 38 | |
| 42 | - abstract protected function render_callback(); | |
| 39 | + protected function render(){ | |
| 40 | + $settings = $this->get_settings_for_display(); | |
| 41 | + $this->attributes = &$settings; | |
| 43 | 42 | |
| 44 | - protected function render() { | |
| 45 | - $settings = $this->get_settings_for_display(); | |
| 46 | - $this->attributes = &$settings; | |
| 43 | + $this->reset_attributes(); | |
| 47 | 44 | |
| 48 | - $this->reset_attributes(); | |
| 45 | + do_action_ref_array( 'betterdocs_before_render', [ &$this, 'elementor' ] ); | |
| 49 | 46 | |
| 50 | - do_action_ref_array( 'betterdocs_before_render', [ &$this, 'elementor' ] ); | |
| 47 | + $this->render_callback(); | |
| 51 | 48 | |
| 52 | - $this->render_callback(); | |
| 53 | - | |
| 54 | - do_action_ref_array( 'betterdocs_after_render', [ &$this, 'elementor' ] ); | |
| 55 | - } | |
| 49 | + do_action_ref_array( 'betterdocs_after_render', [ &$this, 'elementor' ] ); | |
| 50 | + } | |
| 56 | 51 | } |