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