Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在it';divi builder中的子模块?_Php_Wordpress_Wordpress Theming - Fatal编程技术网

Php 如何在it';divi builder中的子模块?

Php 如何在it';divi builder中的子模块?,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我已经创建了自定义的divi builder模块及其子模块。现在我需要父atts值在它的子模块,但我找不到解决这个问题的方法。 这是我的自定义模块类 父模块类: class Wb_Custom_Module_Revision extends ET_Builder_Module { function init () { $this->name = __( 'Wb Revision Log', 'wb' ); $this->slug = 'et_pb_wb_revisi

我已经创建了自定义的divi builder模块及其子模块。现在我需要父atts值在它的子模块,但我找不到解决这个问题的方法。 这是我的自定义模块类

父模块类:

class Wb_Custom_Module_Revision extends ET_Builder_Module {

function init () {
    $this->name = __( 'Wb Revision Log', 'wb' );
    $this->slug = 'et_pb_wb_revision';
    $this->fb_support      = true;
    $this->child_slug      = 'et_pb_wb_revision_child';
    $this->child_item_text = esc_html__( 'Revision Item', 'et_builder' );
    $this->whitelisted_fields = array('vertical_divider_line');
    $this->fields_defaults = array(
        'title' => array( 'Revision Log', 'add_default_setting' ),
    );
    $this->main_css_element = '%%order_class%%';
}
function get_fields () {
    $fields = array(
        'vertical_divider_line' => array(
            'label' => __( 'Horizontal line', 'wb' ),
            'type' => 'text',
            'description' => __( 'Leave empty to not display', 'wb' ),
        ),
    );
    return $fields;
}
function shortcode_callback ( $atts, $content = null, $function_name ) {

   //my shortcode function 
    return ;
}
}
new Wb_Custom_Module_Revision;
class Wb_Custom_Module_Revision_Item extends ET_Builder_Module {

function init() {
    $this->name             = esc_html__( 'Revision Item', 'et_builder' );
    $this->slug             = 'et_pb_wb_revision_child';
    $this->fb_support       = true;
    $this->type             = 'child';
    $this->child_title_var  = 'content_new';

function shortcode_callback( $atts, $content = null, $function_name ) {
    //i need here it's parent "vertical_divider_line" field value. 

    return $output;
}
}
new Wb_Custom_Module_Revision_Item;
子模块类:

class Wb_Custom_Module_Revision extends ET_Builder_Module {

function init () {
    $this->name = __( 'Wb Revision Log', 'wb' );
    $this->slug = 'et_pb_wb_revision';
    $this->fb_support      = true;
    $this->child_slug      = 'et_pb_wb_revision_child';
    $this->child_item_text = esc_html__( 'Revision Item', 'et_builder' );
    $this->whitelisted_fields = array('vertical_divider_line');
    $this->fields_defaults = array(
        'title' => array( 'Revision Log', 'add_default_setting' ),
    );
    $this->main_css_element = '%%order_class%%';
}
function get_fields () {
    $fields = array(
        'vertical_divider_line' => array(
            'label' => __( 'Horizontal line', 'wb' ),
            'type' => 'text',
            'description' => __( 'Leave empty to not display', 'wb' ),
        ),
    );
    return $fields;
}
function shortcode_callback ( $atts, $content = null, $function_name ) {

   //my shortcode function 
    return ;
}
}
new Wb_Custom_Module_Revision;
class Wb_Custom_Module_Revision_Item extends ET_Builder_Module {

function init() {
    $this->name             = esc_html__( 'Revision Item', 'et_builder' );
    $this->slug             = 'et_pb_wb_revision_child';
    $this->fb_support       = true;
    $this->type             = 'child';
    $this->child_title_var  = 'content_new';

function shortcode_callback( $atts, $content = null, $function_name ) {
    //i need here it's parent "vertical_divider_line" field value. 

    return $output;
}
}
new Wb_Custom_Module_Revision_Item;
我需要在其子模块shortcode_回调函数中使用父模块字段值。 请帮我解决这个问题。
谢谢

您可以通过调用此类方法来获取父模块:

$parent_module=self::get_parent_modules('page')['et_pb_wb_revision']

然后您可以获得所需的字段值:

$parent_module->shortcode_atts[“垂直分割线”]


希望有帮助

self::get_parent_模块('page')['et_pb_section']适合我!jsx文件呢?如何在jsx文件中执行相同的操作?