Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: FullwidthMap.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Fullwidth_Map extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Fullwidth Map', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Fullwidth Maps', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_fullwidth_map';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
$this->fullwidth = true;
[8] Fix | Delete
$this->child_slug = 'et_pb_map_pin';
[9] Fix | Delete
$this->child_item_text = esc_html__( 'Pin', 'et_builder' );
[10] Fix | Delete
$this->settings_modal_toggles = array(
[11] Fix | Delete
'general' => array(
[12] Fix | Delete
'toggles' => array(
[13] Fix | Delete
'map' => esc_html__( 'Map', 'et_builder' ),
[14] Fix | Delete
),
[15] Fix | Delete
),
[16] Fix | Delete
'advanced' => array(
[17] Fix | Delete
'toggles' => array(
[18] Fix | Delete
'controls' => esc_html__( 'Controls', 'et_builder' ),
[19] Fix | Delete
'child_filters' => array(
[20] Fix | Delete
'title' => esc_html__( 'Map', 'et_builder' ),
[21] Fix | Delete
'priority' => 51,
[22] Fix | Delete
),
[23] Fix | Delete
),
[24] Fix | Delete
),
[25] Fix | Delete
);
[26] Fix | Delete
[27] Fix | Delete
$this->advanced_fields = array(
[28] Fix | Delete
'box_shadow' => array(
[29] Fix | Delete
'default' => array(
[30] Fix | Delete
'css' => array(
[31] Fix | Delete
'overlay' => 'inset',
[32] Fix | Delete
),
[33] Fix | Delete
),
[34] Fix | Delete
),
[35] Fix | Delete
'margin_padding' => array(
[36] Fix | Delete
'css' => array(
[37] Fix | Delete
'important' => array( 'custom_margin' ), // needed to overwrite last module margin-bottom styling
[38] Fix | Delete
),
[39] Fix | Delete
),
[40] Fix | Delete
'filters' => array(
[41] Fix | Delete
'css' => array(
[42] Fix | Delete
'main' => '%%order_class%%',
[43] Fix | Delete
),
[44] Fix | Delete
'child_filters_target' => array(
[45] Fix | Delete
'tab_slug' => 'advanced',
[46] Fix | Delete
'toggle_slug' => 'child_filters',
[47] Fix | Delete
'label' => esc_html__( 'Map', 'et_builder' ),
[48] Fix | Delete
),
[49] Fix | Delete
),
[50] Fix | Delete
'child_filters' => array(
[51] Fix | Delete
'css' => array(
[52] Fix | Delete
'main' => '%%order_class%% .gm-style>div>div>div>div>div>img',
[53] Fix | Delete
),
[54] Fix | Delete
),
[55] Fix | Delete
'height' => array(
[56] Fix | Delete
'css' => array(
[57] Fix | Delete
'main' => '%%order_class%% > .et_pb_map',
[58] Fix | Delete
),
[59] Fix | Delete
'options' => array(
[60] Fix | Delete
'height' => array(
[61] Fix | Delete
'default' => '440px',
[62] Fix | Delete
'default_tablet' => '350px',
[63] Fix | Delete
'default_phone' => '200px',
[64] Fix | Delete
),
[65] Fix | Delete
),
[66] Fix | Delete
),
[67] Fix | Delete
'fonts' => false,
[68] Fix | Delete
'text' => false,
[69] Fix | Delete
'button' => false,
[70] Fix | Delete
);
[71] Fix | Delete
[72] Fix | Delete
$this->help_videos = array(
[73] Fix | Delete
array(
[74] Fix | Delete
'id' => 'JtTSSI6wlU0',
[75] Fix | Delete
'name' => esc_html__( 'An introduction to the Fullwidth Map module', 'et_builder' ),
[76] Fix | Delete
),
[77] Fix | Delete
);
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
function get_fields() {
[81] Fix | Delete
$fields = array(
[82] Fix | Delete
'google_maps_script_notice' => array(
[83] Fix | Delete
'type' => 'warning',
[84] Fix | Delete
'value' => et_pb_enqueue_google_maps_script(),
[85] Fix | Delete
'display_if' => false,
[86] Fix | Delete
'message' => esc_html__(
[87] Fix | Delete
sprintf(
[88] Fix | Delete
'The Google Maps API Script is currently disabled in the <a href="%s" target="_blank">Theme Options</a>. This module will not function properly without the Google Maps API.',
[89] Fix | Delete
admin_url( 'admin.php?page=et_divi_options' )
[90] Fix | Delete
),
[91] Fix | Delete
'et_builder'
[92] Fix | Delete
),
[93] Fix | Delete
'toggle_slug' => 'map',
[94] Fix | Delete
),
[95] Fix | Delete
'google_api_key' => array(
[96] Fix | Delete
'label' => esc_html__( 'Google API Key', 'et_builder' ),
[97] Fix | Delete
'type' => 'text',
[98] Fix | Delete
'option_category' => 'basic_option',
[99] Fix | Delete
'attributes' => 'readonly',
[100] Fix | Delete
'additional_button' => sprintf(
[101] Fix | Delete
' <a href="%2$s" target="_blank" class="et_pb_update_google_key button" data-empty_text="%3$s">%1$s</a>',
[102] Fix | Delete
esc_html__( 'Change API Key', 'et_builder' ),
[103] Fix | Delete
esc_url( et_pb_get_options_page_link() ),
[104] Fix | Delete
esc_attr__( 'Add Your API Key', 'et_builder' )
[105] Fix | Delete
),
[106] Fix | Delete
'additional_button_type' => 'change_google_api_key',
[107] Fix | Delete
'class' => array( 'et_pb_google_api_key', 'et-pb-helper-field' ),
[108] Fix | Delete
'description' => et_get_safe_localization( sprintf( __( 'The Maps module uses the Google Maps API and requires a valid Google API Key to function. Before using the map module, please make sure you have added your API key inside the Divi Theme Options panel. Learn more about how to create your Google API Key <a href="%1$s" target="_blank">here</a>.', 'et_builder' ), esc_url( 'http://www.elegantthemes.com/gallery/divi/documentation/map/#gmaps-api-key' ) ) ),
[109] Fix | Delete
'toggle_slug' => 'map',
[110] Fix | Delete
),
[111] Fix | Delete
'address' => array(
[112] Fix | Delete
'label' => esc_html__( 'Map Center Address', 'et_builder' ),
[113] Fix | Delete
'type' => 'text',
[114] Fix | Delete
'option_category' => 'basic_option',
[115] Fix | Delete
'additional_button' => sprintf(
[116] Fix | Delete
' <a href="#" class="et_pb_find_address button">%1$s</a>',
[117] Fix | Delete
esc_html__( 'Find', 'et_builder' )
[118] Fix | Delete
),
[119] Fix | Delete
'class' => array( 'et_pb_address' ),
[120] Fix | Delete
'description' => esc_html__( 'Enter an address for the map center point, and the address will be geocoded and displayed on the map below.', 'et_builder' ),
[121] Fix | Delete
'toggle_slug' => 'map',
[122] Fix | Delete
),
[123] Fix | Delete
'zoom_level' => array(
[124] Fix | Delete
'type' => 'hidden',
[125] Fix | Delete
'class' => array( 'et_pb_zoom_level' ),
[126] Fix | Delete
'default' => '18',
[127] Fix | Delete
),
[128] Fix | Delete
'address_lat' => array(
[129] Fix | Delete
'type' => 'hidden',
[130] Fix | Delete
'class' => array( 'et_pb_address_lat' ),
[131] Fix | Delete
),
[132] Fix | Delete
'address_lng' => array(
[133] Fix | Delete
'type' => 'hidden',
[134] Fix | Delete
'class' => array( 'et_pb_address_lng' ),
[135] Fix | Delete
),
[136] Fix | Delete
'map_center_map' => array(
[137] Fix | Delete
'type' => 'center_map',
[138] Fix | Delete
'use_container_wrapper' => false,
[139] Fix | Delete
'option_category' => 'basic_option',
[140] Fix | Delete
'toggle_slug' => 'map',
[141] Fix | Delete
),
[142] Fix | Delete
'mouse_wheel' => array(
[143] Fix | Delete
'label' => esc_html__( 'Mouse Wheel Zoom', 'et_builder' ),
[144] Fix | Delete
'type' => 'yes_no_button',
[145] Fix | Delete
'option_category' => 'configuration',
[146] Fix | Delete
'options' => array(
[147] Fix | Delete
'on' => et_builder_i18n( 'On' ),
[148] Fix | Delete
'off' => et_builder_i18n( 'Off' ),
[149] Fix | Delete
),
[150] Fix | Delete
'tab_slug' => 'advanced',
[151] Fix | Delete
'toggle_slug' => 'controls',
[152] Fix | Delete
'description' => esc_html__( 'Here you can choose whether the zoom level will be controlled by mouse wheel or not.', 'et_builder' ),
[153] Fix | Delete
'default_on_front' => 'on',
[154] Fix | Delete
),
[155] Fix | Delete
'mobile_dragging' => array(
[156] Fix | Delete
'label' => esc_html__( 'Draggable On Mobile', 'et_builder' ),
[157] Fix | Delete
'type' => 'yes_no_button',
[158] Fix | Delete
'option_category' => 'configuration',
[159] Fix | Delete
'options' => array(
[160] Fix | Delete
'on' => et_builder_i18n( 'On' ),
[161] Fix | Delete
'off' => et_builder_i18n( 'Off' ),
[162] Fix | Delete
),
[163] Fix | Delete
'tab_slug' => 'advanced',
[164] Fix | Delete
'toggle_slug' => 'controls',
[165] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not the map will be draggable on mobile devices.', 'et_builder' ),
[166] Fix | Delete
'default_on_front' => 'on',
[167] Fix | Delete
),
[168] Fix | Delete
'use_grayscale_filter' => array(
[169] Fix | Delete
'label' => esc_html__( 'Use Grayscale Filter', 'et_builder' ),
[170] Fix | Delete
'description' => esc_html__( 'Adjusting the grayscale filter will allow you to change the color saturation of the map.', 'et_builder' ),
[171] Fix | Delete
'type' => 'hidden',
[172] Fix | Delete
'option_category' => 'configuration',
[173] Fix | Delete
'options' => array(
[174] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[175] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[176] Fix | Delete
),
[177] Fix | Delete
'affects' => array(
[178] Fix | Delete
'grayscale_filter_amount',
[179] Fix | Delete
),
[180] Fix | Delete
'tab_slug' => 'advanced',
[181] Fix | Delete
'toggle_slug' => 'child_filters',
[182] Fix | Delete
'default_on_front' => 'off',
[183] Fix | Delete
),
[184] Fix | Delete
'grayscale_filter_amount' => array(
[185] Fix | Delete
'label' => esc_html__( 'Grayscale Filter Amount (%)', 'et_builder' ),
[186] Fix | Delete
'description' => esc_html__( 'Adjusting the grayscale filter will allow you to change the color saturation of the map.', 'et_builder' ),
[187] Fix | Delete
'type' => 'hidden',
[188] Fix | Delete
'default_on_front' => '0',
[189] Fix | Delete
'option_category' => 'configuration',
[190] Fix | Delete
'tab_slug' => 'advanced',
[191] Fix | Delete
'toggle_slug' => 'child_filters',
[192] Fix | Delete
'depends_show_if' => 'on',
[193] Fix | Delete
'validate_unit' => false,
[194] Fix | Delete
),
[195] Fix | Delete
);
[196] Fix | Delete
return $fields;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Renders the module output.
[201] Fix | Delete
*
[202] Fix | Delete
* @param array $attrs List of attributes.
[203] Fix | Delete
* @param string $content Content being processed.
[204] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[205] Fix | Delete
*
[206] Fix | Delete
* @return string
[207] Fix | Delete
*/
[208] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[209] Fix | Delete
$address_lat = $this->props['address_lat'];
[210] Fix | Delete
$address_lng = $this->props['address_lng'];
[211] Fix | Delete
$zoom_level = $this->props['zoom_level'];
[212] Fix | Delete
$mouse_wheel = $this->props['mouse_wheel'];
[213] Fix | Delete
$mobile_dragging = $this->props['mobile_dragging'];
[214] Fix | Delete
$use_grayscale_filter = $this->props['use_grayscale_filter'];
[215] Fix | Delete
$grayscale_filter_amount = $this->props['grayscale_filter_amount'];
[216] Fix | Delete
[217] Fix | Delete
if ( et_pb_enqueue_google_maps_script() ) {
[218] Fix | Delete
wp_enqueue_script( 'google-maps-api' );
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
$video_background = $this->video_background();
[222] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[223] Fix | Delete
[224] Fix | Delete
$all_pins_content = $this->content;
[225] Fix | Delete
[226] Fix | Delete
$grayscale_filter_data = '';
[227] Fix | Delete
if ( 'on' === $use_grayscale_filter && '' !== $grayscale_filter_amount ) {
[228] Fix | Delete
$grayscale_filter_data = sprintf( ' data-grayscale="%1$s"', esc_attr( $grayscale_filter_amount ) );
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
// Map Tiles: Add CSS Filters and Mix Blend Mode rules (if set)
[232] Fix | Delete
if ( array_key_exists( 'child_filters', $this->advanced_fields ) && array_key_exists( 'css', $this->advanced_fields['child_filters'] ) ) {
[233] Fix | Delete
$this->add_classname(
[234] Fix | Delete
$this->generate_css_filters(
[235] Fix | Delete
$render_slug,
[236] Fix | Delete
'child_',
[237] Fix | Delete
self::$data_utils->array_get( $this->advanced_fields['child_filters']['css'], 'main', '%%order_class%%' )
[238] Fix | Delete
)
[239] Fix | Delete
);
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
// Module classnames
[243] Fix | Delete
$this->add_classname(
[244] Fix | Delete
array(
[245] Fix | Delete
'et_pb_map_container',
[246] Fix | Delete
)
[247] Fix | Delete
);
[248] Fix | Delete
[249] Fix | Delete
// Remove automatically added classname
[250] Fix | Delete
$this->remove_classname( $render_slug );
[251] Fix | Delete
[252] Fix | Delete
$output = sprintf(
[253] Fix | Delete
'<div%5$s class="%6$s"%11$s>
[254] Fix | Delete
%10$s
[255] Fix | Delete
%9$s
[256] Fix | Delete
<div class="et_pb_map" data-center-lat="%1$s" data-center-lng="%2$s" data-zoom="%3$d" data-mouse-wheel="%7$s" data-mobile-dragging="%8$s"></div>
[257] Fix | Delete
%4$s
[258] Fix | Delete
</div>',
[259] Fix | Delete
esc_attr( $address_lat ),
[260] Fix | Delete
esc_attr( $address_lng ),
[261] Fix | Delete
esc_attr( $zoom_level ),
[262] Fix | Delete
$all_pins_content,
[263] Fix | Delete
$this->module_id(),
[264] Fix | Delete
$this->module_classname( $render_slug ),
[265] Fix | Delete
esc_attr( $mouse_wheel ),
[266] Fix | Delete
esc_attr( $mobile_dragging ),
[267] Fix | Delete
$video_background,
[268] Fix | Delete
$parallax_image_background,
[269] Fix | Delete
$grayscale_filter_data
[270] Fix | Delete
);
[271] Fix | Delete
[272] Fix | Delete
return $output;
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
new ET_Builder_Module_Fullwidth_Map();
[277] Fix | Delete
[278] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function