File: /home/lucendi/www/wp-content/themes/divi/includes/builder/module/Code.php
<?php
class ET_Builder_Module_Code extends ET_Builder_Module {
function __construct() {
parent::__construct();
$fields = array_keys( ET_Builder_Module_Fields_Factory::get( 'BoxShadow' )->get_fields() );
foreach ( $fields as $field ) {
if ( isset( $this->_additional_fields_options[ $field ] ) ) {
unset( $this->_additional_fields_options[ $field ] );
}
if ( isset( $this->fields_unprocessed[ $field ] ) ) {
unset( $this->fields_unprocessed[ $field ] );
}
}
}
function init() {
$this->name = esc_html__( 'Code', 'et_builder' );
$this->slug = 'et_pb_code';
$this->fb_support = true;
$this->use_row_content = true;
$this->decode_entities = true;
$this->whitelisted_fields = array(
'raw_content',
'admin_label',
'module_id',
'module_class',
);
$this->options_toggles = array(
'general' => array(
'toggles' => array(
'main_content' => esc_html__( 'Text', 'et_builder' ),
),
),
'advanced' => array(
'toggles' => array(
'width' => array(
'title' => esc_html__( 'Sizing', 'et_builder' ),
'priority' => 65,
),
),
),
);
$this->advanced_options = array(
'background' => array(),
'custom_margin_padding' => array(
'css' => array(
'important' => array( 'custom_margin' ), // needed to overwrite last module margin-bottom styling
),
),
'max_width' => array(),
'text' => array(),
'filters' => array(),
);
// wptexturize is often incorrectly parsed single and double quotes
// This disables wptexturize on this module
add_filter( 'no_texturize_shortcodes', array( $this, 'disable_wptexturize' ) );
}
function get_fields() {
$fields = array(
'raw_content' => array(
'label' => esc_html__( 'Content', 'et_builder' ),
'type' => 'textarea',
'option_category' => 'basic_option',
'description' => esc_html__( 'Here you can create the content that will be used within the module.', 'et_builder' ),
'is_fb_content' => true,
'toggle_slug' => 'main_content',
),
'disabled_on' => array(
'label' => esc_html__( 'Disable on', 'et_builder' ),
'type' => 'multiple_checkboxes',
'options' => array(
'phone' => esc_html__( 'Phone', 'et_builder' ),
'tablet' => esc_html__( 'Tablet', 'et_builder' ),
'desktop' => esc_html__( 'Desktop', 'et_builder' ),
),
'additional_att' => 'disable_on',
'option_category' => 'configuration',
'description' => esc_html__( 'This will disable the module on selected devices', 'et_builder' ),
'tab_slug' => 'custom_css',
'toggle_slug' => 'visibility',
),
'admin_label' => array(
'label' => esc_html__( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => esc_html__( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
'toggle_slug' => 'admin_label',
),
'module_id' => array(
'label' => esc_html__( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'tab_slug' => 'custom_css',
'toggle_slug' => 'classes',
'option_class' => 'et_pb_custom_css_regular',
),
'module_class' => array(
'label' => esc_html__( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'tab_slug' => 'custom_css',
'toggle_slug' => 'classes',
'option_class' => 'et_pb_custom_css_regular',
),
);
return $fields;
}
// Don't add text-shadow fields since they already are via font-options
protected function _add_additional_text_shadow_fields() {}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
$this->shortcode_content = et_builder_convert_line_breaks( et_builder_replace_code_content_entities( $this->shortcode_content ) );
$output = sprintf(
'<div%2$s class="et_pb_code et_pb_module%3$s%4$s%6$s%8$s">
%7$s
%5$s
<div class="et_pb_code_inner">
%1$s
</div> <!-- .et_pb_code_inner -->
</div> <!-- .et_pb_code -->',
$this->shortcode_content,
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
'' !== $video_background ? ' et_pb_section_video et_pb_preload' : '',
$video_background,
'' !== $parallax_image_background ? ' et_pb_section_parallax' : '',
$parallax_image_background,
$this->get_text_orientation_classname()
);
return $output;
}
public function _add_additional_shadow_fields() {
}
protected function _add_additional_border_fields() {
return false;
}
function process_advanced_border_options( $function_name ) {
return false;
}
}
new ET_Builder_Module_Code;