1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
wp_enqueue_script( 'wplink' ); |
4
|
|
|
wp_enqueue_style( 'editor-buttons' ); |
5
|
|
|
|
6
|
|
|
wp_enqueue_script( 'pods-link-picker', PODS_URL . 'ui/js/pods-link-picker.js', array( 'jquery' ), '1.0.0' ); |
7
|
|
|
|
8
|
|
|
PodsForm::field_method( 'link', 'validate_link_modal' ); |
9
|
|
|
|
10
|
|
|
$url_attributes = array(); |
11
|
|
|
$url_type = 'text'; |
12
|
|
|
if ( 1 == pods_var( 'link_html5', $options ) ) { |
13
|
|
|
$url_type = 'url'; |
14
|
|
|
} |
15
|
|
|
$url_attributes['type'] = $url_type; |
16
|
|
|
$url_attributes['class'] = 'linkPickerUrl'; |
17
|
|
|
$url_attributes['value'] = ( isset( $value['url'] ) ? $value['url'] : '' ); |
18
|
|
|
$url_attributes['tabindex'] = 2; |
19
|
|
|
$url_name = $name . '[url]'; |
20
|
|
|
$url_attributes = PodsForm::merge_attributes( $url_attributes, $url_name, $form_field_type, $options ); |
21
|
|
|
|
22
|
|
|
$text_attributes = array(); |
23
|
|
|
$text_type = 'text'; |
24
|
|
|
$text_attributes['type'] = $text_type; |
25
|
|
|
$text_attributes['class'] = 'linkPickerText'; |
26
|
|
|
$text_attributes['value'] = ( isset( $value['text'] ) ? $value['text'] : '' ); |
27
|
|
|
$text_attributes['tabindex'] = 2; |
28
|
|
|
$text_name = $name . '[text]'; |
29
|
|
|
$text_attributes = PodsForm::merge_attributes( $text_attributes, $text_name, $form_field_type, $options ); |
30
|
|
|
|
31
|
|
|
$target_attributes = array(); |
32
|
|
|
$target_type = 'checkbox'; |
33
|
|
|
$target_attributes['type'] = $target_type; |
34
|
|
|
$target_attributes['class'] = 'linkPickerTarget'; |
35
|
|
|
$target_attributes['value'] = '_blank'; |
36
|
|
|
$target_attributes['tabindex'] = 2; |
37
|
|
|
$target_attributes['style'] = 'display: inline-block;'; |
38
|
|
|
if ( isset( $value['target'] ) && $value['target'] == '_blank' || ( ! isset( $value['target'] ) && ! empty( $options['link_new_window'] ) ) ) { |
|
|
|
|
39
|
|
|
$target_attributes['checked'] = 'checked'; |
40
|
|
|
} |
41
|
|
|
$target_name = $name . '[target]'; |
42
|
|
|
$target_attributes = PodsForm::merge_attributes( $target_attributes, $target_name, $form_field_type, $options ); |
43
|
|
|
|
44
|
|
|
$attributes = array(); |
45
|
|
|
$attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options, 'pods-ui-field-link' ); |
46
|
|
|
$class_attributes = array( 'class' => $attributes['class'] ); |
47
|
|
|
?> |
48
|
|
|
|
49
|
|
|
<div<?php PodsForm::attributes( $class_attributes, $name, $form_field_type, $options ); ?>> |
50
|
|
|
<div class="pods-link-options"> |
51
|
|
|
<p class="howto"><?php _e( 'Enter the destination URL' ); ?></p> |
52
|
|
|
<p> |
53
|
|
|
<div class="alignleft"> |
54
|
|
|
<label><span><?php _e( 'URL' ); ?></span><input<?php PodsForm::attributes( $url_attributes, $url_name, $form_field_type, $options ); ?> /></label> |
55
|
|
|
</div> |
56
|
|
|
<div class="alignleft"> |
57
|
|
|
<label><span><?php _e( 'Link Text' ); ?></span><input<?php PodsForm::attributes( $text_attributes, $text_name, $form_field_type, $options ); ?> /></label> |
58
|
|
|
</div> |
59
|
|
|
<div class="link-target"> |
60
|
|
|
<label> |
61
|
|
|
<div> </div> |
62
|
|
|
<input<?php PodsForm::attributes( $target_attributes, $target_name, $form_field_type, $options ); ?> /> <?php _e( 'Open link in a new tab' ); ?> |
63
|
|
|
</label> |
64
|
|
|
</div> |
65
|
|
|
</p> <br clear="both"> |
66
|
|
|
|
67
|
|
|
<?php if ( 1 == pods_v( 'link_select_existing', $options, 1 ) ) { ?> |
68
|
|
|
<div class="howto link-existing-content" style="display: none;"> |
69
|
|
|
<a href="#" class="podsLinkPopup"><?php _e( 'Or link to existing content' ); ?></a> |
70
|
|
|
<textarea id="pods-link-editor-hidden" disabled="disabled" style="display: none;"></textarea> |
71
|
|
|
</div> |
72
|
|
|
<?php } ?> |
73
|
|
|
</div> |
74
|
|
|
</div> |
75
|
|
|
|
76
|
|
|
<?php |
77
|
|
|
PodsForm::regex( $form_field_type, $options ); |
78
|
|
|
|