PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.3
Elementor Website Builder – more than just a page builder v3.32.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / url.php

url.php in Elementor Website Builder – more than just a page builder 3.32.3, at includes/controls/url.php

134 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use Elementor\Modules\DynamicTags\Module as TagsModule;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10 /**
11 * Elementor URL control.
12 *
13 * A base control for creating url control. Displays a URL input with the
14 * ability to set the target of the link to `_blank` to open in a new tab.
15 *
16 * @since 1.0.0
17 */
18 class Control_URL extends Control_Base_Multiple {
19
20 /**
21 * Get url control type.
22 *
23 * Retrieve the control type, in this case `url`.
24 *
25 * @since 1.0.0
26 * @access public
27 *
28 * @return string Control type.
29 */
30 public function get_type() {
31 return 'url';
32 }
33
34 /**
35 * Get url control default values.
36 *
37 * Retrieve the default value of the url control. Used to return the default
38 * values while initializing the url control.
39 *
40 * @since 1.0.0
41 * @access public
42 *
43 * @return array Control default value.
44 */
45 public function get_default_value() {
46 return [
47 'url' => '',
48 'is_external' => '',
49 'nofollow' => '',
50 'custom_attributes' => '',
51 ];
52 }
53
54 /**
55 * Get url control default settings.
56 *
57 * Retrieve the default settings of the url control. Used to return the default
58 * settings while initializing the url control.
59 *
60 * @since 1.0.0
61 * @access protected
62 *
63 * @return array Control default settings.
64 */
65 protected function get_default_settings() {
66 return [
67 'label_block' => true,
68 'placeholder' => esc_html__( 'Type or paste your URL', 'elementor' ),
69 'autocomplete' => true,
70 'options' => [ 'is_external', 'nofollow', 'custom_attributes' ],
71 'dynamic' => [
72 'categories' => [ TagsModule::URL_CATEGORY ],
73 'property' => 'url',
74 ],
75 'custom_attributes_description' => sprintf(
76 '%1$s <a target="_blank" href="https://go.elementor.com/panel-link-custom-attributes/">%2$s</a>',
77 esc_html__( 'Set custom attributes for the link element. Separate attribute keys from values using the | (pipe) character. Separate key-value pairs with a comma.', 'elementor' ),
78 esc_html__( 'Learn more', 'elementor' )
79 ),
80 ];
81 }
82
83 /**
84 * Render url control output in the editor.
85 *
86 * Used to generate the control HTML in the editor using Underscore JS
87 * template. The variables for the class are available using `data` JS
88 * object.
89 *
90 * @since 1.0.0
91 * @access public
92 */
93 public function content_template() {
94 ?>
95 <div class="elementor-control-field elementor-control-url-external-{{{ ( data.options.length || data.show_external ) ? 'show' : 'hide' }}}">
96 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
97 <div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
98 <i class="elementor-control-url-autocomplete-spinner eicon-loading eicon-animation-spin" aria-hidden="true"></i>
99 <input id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area elementor-input" data-setting="url" placeholder="{{ view.getControlPlaceholder() }}" />
100 <?php // PHPCS - Nonces don't require escaping. ?>
101 <input id="_ajax_linking_nonce" type="hidden" value="<?php echo wp_create_nonce( 'internal-linking' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
102 <# if ( !! data.options ) { #>
103 <button class="elementor-control-url-more tooltip-target elementor-control-unit-1" data-tooltip="<?php echo esc_attr__( 'Link Options', 'elementor' ); ?>" aria-label="<?php echo esc_attr__( 'Link Options', 'elementor' ); ?>">
104 <i class="eicon-cog" aria-hidden="true"></i>
105 </button>
106 <# } #>
107 </div>
108 <# if ( !! data.options ) { #>
109 <div class="elementor-control-url-more-options">
110 <div class="elementor-control-url-option">
111 <input id="<?php $this->print_control_uid( 'is_external' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="is_external">
112 <label for="<?php $this->print_control_uid( 'is_external' ); ?>"><?php echo esc_html__( 'Open in new window', 'elementor' ); ?></label>
113 </div>
114 <div class="elementor-control-url-option">
115 <input id="<?php $this->print_control_uid( 'nofollow' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="nofollow">
116 <label for="<?php $this->print_control_uid( 'nofollow' ); ?>"><?php echo esc_html__( 'Add nofollow', 'elementor' ); ?></label>
117 </div>
118 <div class="elementor-control-url__custom-attributes elementor-control-direction-ltr">
119 <label for="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-url__custom-attributes-label"><?php echo esc_html__( 'Custom Attributes', 'elementor' ); ?></label>
120 <input type="text" id="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-unit-5" placeholder="key|value" data-setting="custom_attributes">
121 </div>
122 <# if ( ( data.options && -1 !== data.options.indexOf( 'custom_attributes' ) ) && data.custom_attributes_description ) { #>
123 <div class="elementor-control-field-description">{{{ data.custom_attributes_description }}}</div>
124 <# } #>
125 </div>
126 <# } #>
127 </div>
128 <# if ( data.description ) { #>
129 <div class="elementor-control-field-description">{{{ data.description }}}</div>
130 <# } #>
131 <?php
132 }
133 }
134