| @@ -540,10 +540,24 @@ | ||
| 540 | 540 | $config['elements'] = $this->get_elements_raw_data( null, true ); |
| 541 | 541 | $config['widgets'] = Plugin::$instance->widgets_manager->get_widget_types_config(); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $additional_config = apply_filters( 'elementor/document/config', [], $this->get_main_id() ); | |
| 544 | + $additional_config = []; | |
| 545 | 545 | |
| 546 | + /** | |
| 547 | + * Additional document configuration. | |
| 548 | + * | |
| 549 | + * Filters the document configuration by adding additional configuration. | |
| 550 | + * External developers can use this hook to add custom configuration in | |
| 551 | + * addition to Elementor's initial configuration. | |
| 552 | + * | |
| 553 | + * Use the $post_id to add custom configuration for different pages. | |
| 554 | + * | |
| 555 | + * @param array $additional_config The additional document configuration. | |
| 556 | + * @param int $post_id The post ID of the document. | |
| 557 | + */ | |
| 558 | + $additional_config = apply_filters( 'elementor/document/config', $additional_config, $this->get_main_id() ); | |
| 559 | + | |
| 546 | 560 | if ( ! empty( $additional_config ) ) { |
| 547 | 561 | $config = array_replace_recursive( $config, $additional_config ); |
| 548 | 562 | } |
| 549 | 563 | |
| @@ -555,13 +569,16 @@ | ||
| 555 | 569 | * @access protected |
| 556 | 570 | */ |
| 557 | 571 | protected function register_controls() { |
| 558 | 572 | $this->register_document_controls(); |
| 573 | + | |
| 559 | 574 | /** |
| 560 | 575 | * Register document controls. |
| 561 | 576 | * |
| 562 | 577 | * Fires after Elementor registers the document controls. |
| 563 | 578 | * |
| 579 | + * External developers can use this hook to add new controls to the document. | |
| 580 | + * | |
| 564 | 581 | * @since 2.0.0 |
| 565 | 582 | * |
| 566 | 583 | * @param Document $this The document instance. |
| 567 | 584 | */ |
| @@ -577,14 +594,19 @@ | ||
| 577 | 594 | * @return bool |
| 578 | 595 | */ |
| 579 | 596 | public function save( $data ) { |
| 580 | 597 | /** |
| 581 | - * Fires when document save starts on Elementor. | |
| 598 | + * Document save data. | |
| 582 | 599 | * |
| 583 | - * @param array $data. | |
| 584 | - * @param \Elementor\Core\Base\Document $this The current document. | |
| 600 | + * Filter the document data before saving process starts. | |
| 585 | 601 | * |
| 602 | + * External developers can use this hook to change the data before | |
| 603 | + * saving it to the database. | |
| 604 | + * | |
| 586 | 605 | * @since 3.3.0 |
| 606 | + * | |
| 607 | + * @param array $data The document data. | |
| 608 | + * @param \Elementor\Core\Base\Document $this The document instance. | |
| 587 | 609 | */ |
| 588 | 610 | $data = apply_filters( 'elementor/document/save/data', $data, $this ); |
| 589 | 611 | |
| 590 | 612 | $this->add_handle_revisions_changed_filter(); |