Php 如何在it';divi builder中的子模块?
我已经创建了自定义的divi builder模块及其子模块。现在我需要父atts值在它的子模块,但我找不到解决这个问题的方法。 这是我的自定义模块类 父模块类: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
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文件中执行相同的操作?