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