Changeset 1333592
- Timestamp:
- 01/22/2016 10:18:00 AM (10 years ago)
- Location:
- advanced-custom-fields-link-picker-field/trunk
- Files:
-
- 6 added
- 5 edited
-
acf-link_picker-v4.php (modified) (4 diffs)
-
acf-link_picker-v5.php (modified) (4 diffs)
-
acf-link_picker.php (modified) (1 diff)
-
js/input.js (modified) (1 diff)
-
lang/acf-link_picker-de_DE.mo (added)
-
lang/acf-link_picker-de_DE.po (added)
-
lang/acf-link_picker-nl_NL.mo (added)
-
lang/acf-link_picker-nl_NL.po (added)
-
lang/acf-link_picker-pt_PT.mo (added)
-
lang/acf-link_picker-pt_PT.po (added)
-
readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-custom-fields-link-picker-field/trunk/acf-link_picker-v4.php
r952692 r1333592 65 65 66 66 // key is needed in the field names to correctly save the data 67 $key = $field[' name'];67 $key = $field['id']; 68 68 69 69 … … 127 127 // create Field HTML 128 128 ?> 129 <div id="link-picker-<?php echo $field[' key']; ?>-wrap">129 <div id="link-picker-<?php echo $field['id']; ?>-wrap"> 130 130 <p> 131 Currently selected page: 131 <?php if ($exists) : ?> 132 <?php _e('Currently selected page', 'acf-link_picker') ?>: 133 <?php endif; ?> 132 134 133 <input type="hidden" name="<?php echo $field['name']; ?>[url]" id="link-picker-<?php echo $field[' key']; ?>-url" value="<?php echo $field['value']['url']; ?>">134 <input type="hidden" name="<?php echo $field['name']; ?>[title]" id="link-picker-<?php echo $field[' key']; ?>-title" value="<?php echo $field['value']['title']; ?>">135 <input type="hidden" name="<?php echo $field['name']; ?>[target]" id="link-picker-<?php echo $field[' key']; ?>-target" value="<?php echo $field['value']['target']; ?>">135 <input type="hidden" name="<?php echo $field['name']; ?>[url]" id="link-picker-<?php echo $field['id']; ?>-url" value="<?php echo $field['value']['url']; ?>"> 136 <input type="hidden" name="<?php echo $field['name']; ?>[title]" id="link-picker-<?php echo $field['id']; ?>-title" value="<?php echo $field['value']['title']; ?>"> 137 <input type="hidden" name="<?php echo $field['name']; ?>[target]" id="link-picker-<?php echo $field['id']; ?>-target" value="<?php echo ( isset($field['value']['target']) ) ? $field['value']['target'] : ''; ?>"> 136 138 137 <div id="link-picker-<?php echo $field[' key']; ?>-exists"<?php if (!$exists) { echo ' style="display:none;"'; } ?>>138 URL: <em id="link-picker-<?php echo $field['key']; ?>-url-label"><a href="<?php echo $field['value']['url']; ?>" target="_blank"><?php echo $field['value']['url']; ?></a></em><br>139 Title: <em id="link-picker-<?php echo $field['key']; ?>-title-label"><?php echo $field['value']['title']; ?></em><br>140 Open in new window: <em id="link-picker-<?php echo $field['key']; ?>-target-label"><?php if (isset($field['value']['target']) && $field['value']['target'] == '_blank') { echo 'Yes'; } ?></em>139 <div id="link-picker-<?php echo $field['id']; ?>-exists"<?php if (!$exists) { echo ' style="display:none;"'; } ?>> 140 <?php _e('URL', 'acf-link_picker') ?>: <em id="link-picker-<?php echo $field['id']; ?>-url-label"><a href="<?php echo $field['value']['url']; ?>" target="_blank"><?php echo $field['value']['url']; ?></a></em><br> 141 <?php _e('Title', 'acf-link_picker') ?>: <em id="link-picker-<?php echo $field['id']; ?>-title-label"><?php echo $field['value']['title']; ?></em><br> 142 <?php _e('Open in new window', 'acf-link_picker') ?>: <em id="link-picker-<?php echo $field['id']; ?>-target-label"><?php if (isset($field['value']['target']) && $field['value']['target'] == '_blank') { _e('Yes', 'acf-link_picker'); } else { _e('No', 'acf-link_picker'); } ?></em> 141 143 </div> 142 <div id="link-picker-<?php echo $field[' key']; ?>-none"<?php if ($exists) { echo ' style="display:none;"'; } ?>>143 <em> No link selected yet</em>144 <div id="link-picker-<?php echo $field['id']; ?>-none"<?php if ($exists) { echo ' style="display:none;"'; } ?>> 145 <em><?php _e('No link selected yet', 'acf-link_picker') ?></em> 144 146 </div> 145 147 </p> 146 148 <p> 147 <a href="" class="link-btn acf-button grey" id="link-picker-<?php echo $field[' key']; ?>"><?php if (!$exists) { echo 'Insert'; }else{ echo 'Edit'; } ?> Link</a>148 <a href="" class="link-remove-btn acf-button grey" id="link-picker-<?php echo $field[' key']; ?>-remove"<?php if (!$exists) { echo ' style="display:none;"'; } ?>>Remove Link</a>149 <a href="" class="link-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>"><?php if (!$exists) { _e('Insert Link', 'acf-link_picker'); }else{ _e('Edit Link', 'acf-link_picker'); } ?></a> 150 <a href="" class="link-remove-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>-remove"<?php if (!$exists) { echo ' style="display:none;"'; } ?>><?php _e('Remove Link', 'acf-link_picker'); ?></a> 149 151 </p> 150 152 </div> … … 171 173 // register ACF scripts 172 174 wp_register_script( 'acf-input-link_picker', $this->settings['dir'] . 'js/input.js', array('acf-input'), $this->settings['version'] ); 173 //wp_register_style( 'acf-input-link_picker', $this->settings['dir'] . 'css/input.css', array('acf-input'), $this->settings['version'] ); 175 wp_register_style( 'acf-input-link_picker', $this->settings['dir'] . 'css/input.css', array('acf-input'), $this->settings['version'] ); 176 177 $translations = array( 178 'insert_link' => __('Insert Link', 'acf-link_picker'), 179 'edit_link' => __('Edit Link', 'acf-link_picker'), 180 'yes' => __('Yes', 'acf-link_picker'), 181 'no' => __('No', 'acf-link_picker') 182 ); 183 184 wp_localize_script('acf-input-link_picker', 'translations', $translations); 174 185 175 186 // scripts … … 179 190 180 191 // styles 181 wp_enqueue_style(array(192 /*wp_enqueue_style(array( 182 193 'acf-input-link_picker', 183 194 )); 195 */ 184 196 185 197 } -
advanced-custom-fields-link-picker-field/trunk/acf-link_picker-v5.php
r966894 r1333592 55 55 56 56 $this->l10n = array( 57 'yes' => __('Yes' ),58 'no' => __('No' ),57 'yes' => __('Yes', 'acf-link_picker'), 58 'no' => __('No', 'acf-link_picker'), 59 59 'edit_link' => __('Edit Link', 'acf-link_picker'), 60 60 'insert_link' => __('Insert Link', 'acf-link_picker') … … 140 140 ?> 141 141 <div id="link-picker-<?php echo $field['id']; ?>-wrap"> 142 <p> 143 <?php _e('Currently selected page:', 'acf-link_picker'); ?> 142 <div> 143 <?php if ($exists) : ?> 144 <p> 145 <?php _e('Currently selected page', 'acf-link_picker'); ?> 146 </p> 147 <?php endif; ?> 144 148 145 149 <input type="hidden" name="<?php echo $field['name']; ?>[url]" id="link-picker-<?php echo $field['id']; ?>-url" value="<?php echo $field['value']['url']; ?>"> … … 148 152 149 153 <div id="link-picker-<?php echo $field['id']; ?>-exists"<?php if (!$exists) { echo ' style="display:none;"'; } ?>> 150 <?php _e('URL'); ?>: <em id="link-picker-<?php echo $field['id']; ?>-url-label"><a href="<?php echo $field['value']['url']; ?>" target="_blank"><?php echo $field['value']['url']; ?></a></em><br> 151 <?php _e('Title'); ?>: <em id="link-picker-<?php echo $field['id']; ?>-title-label"><?php echo $field['value']['title']; ?></em><br> 152 <?php _e('Open link in a new window/tab'); ?>: <em id="link-picker-<?php echo $field['id']; ?>-target-label"><?php if ($field['value']['target'] == '_blank') { _e('Yesssss'); } else { _e('No'); } ?></em> 154 <?php _e('URL', 'acf-link_picker'); ?>: 155 <em id="link-picker-<?php echo $field['id']; ?>-url-label"> 156 <a href="<?php echo $field['value']['url']; ?>" target="_blank"> 157 <?php echo $field['value']['url']; ?> 158 </a> 159 </em> 160 <br> 161 162 <?php _e('Title', 'acf-link_picker'); ?>: 163 <em id="link-picker-<?php echo $field['id']; ?>-title-label"> 164 <?php echo $field['value']['title']; ?> 165 </em> 166 <br> 167 168 <?php _e('Open link in a new window/tab', 'acf-link_picker'); ?>: 169 <em id="link-picker-<?php echo $field['id']; ?>-target-label"> 170 <?php if ($field['value']['target'] == '_blank') { _e('Yes', 'acf-link_picker'); } else { _e('No', 'acf-link_picker'); } ?> 171 </em> 153 172 </div> 154 173 <div id="link-picker-<?php echo $field['id']; ?>-none"<?php if ($exists) { echo ' style="display:none;"'; } ?>> 155 174 <em><?php _e('No link selected yet', 'acf-link_picker'); ?></em> 156 175 </div> 157 </ p>176 </div> 158 177 <p> 159 <a href="" class="link-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>"><?php if (!$exists) { _e('Insert Link', 'acf-link_picker'); }else{ _e('Edit Link', 'acf-link_picker'); } ?></a> 160 <a href="" class="link-remove-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>-remove"<?php if (!$exists) { echo ' style="display:none;"'; } ?>><?php _e('Remove Link', 'acf-link_picker'); ?></a> 178 <a href="" class="link-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>"> 179 <?php if (!$exists) { _e('Insert Link', 'acf-link_picker'); }else{ _e('Edit Link', 'acf-link_picker'); } ?> 180 </a> 181 <a href="" class="link-remove-btn acf-button grey" id="link-picker-<?php echo $field['id']; ?>-remove"<?php if (!$exists) { echo ' style="display:none;"'; } ?>> 182 <?php _e('Remove Link', 'acf-link_picker'); ?> 183 </a> 161 184 </p> 162 185 </div> … … 185 208 // register & include JS 186 209 wp_register_script( 'acf-input-link_picker', "{$dir}js/input.js" ); 210 211 $translations = array( 212 'insert_link' => __('Insert Link', 'acf-link_picker'), 213 'edit_link' => __('Edit Link', 'acf-link_picker'), 214 'yes' => __('Yes', 'acf-link_picker'), 215 'no' => __('No', 'acf-link_picker') 216 ); 217 218 wp_localize_script('acf-input-link_picker', 'translations', $translations); 219 187 220 wp_enqueue_script('acf-input-link_picker'); 188 221 -
advanced-custom-fields-link-picker-field/trunk/acf-link_picker.php
r966894 r1333592 3 3 /* 4 4 Plugin Name: Advanced Custom Fields: Link Picker 5 Plugin URI: http ://biostall.com5 Plugin URI: https://github.com/ahebrank/ACF-Link-Picker-Field 6 6 Description: Adds an Advanced Custom Field field that allows the selection of a link utilising the WordPress link picker modal dialog 7 Version: 1. 0.18 Author : Steve Marks (BIOSTALL)7 Version: 1.1.1 8 Authors: Steve Marks (BIOSTALL) 9 9 Author URI: http://biostall.com 10 10 License: GPLv2 or later -
advanced-custom-fields-link-picker-field/trunk/js/input.js
r966894 r1333592 1 var doingLink = '';2 3 1 (function($){ 4 5 function initialize_field( $el ) { 6 7 //$el.doStuff(); 8 9 jQuery('body').on('click', '.link-btn', function(event) 10 { 11 var thisID = jQuery(this).attr("id"); 2 3 var doingLink = ''; 4 var modal_bound = false; 5 6 function trap_events(event) { 7 //trap any events 8 if (typeof event.preventDefault != 'undefined') 9 { 10 event.preventDefault(); 11 } 12 else 13 { 14 event.returnValue = false; 15 } 16 event.stopPropagation(); 17 } 18 19 function initialize_field( $el ) { 20 console.log($el); 21 $el.on('click', 'a.link-btn', function(event) 22 { 23 console.log('here'); 24 trap_events(event); 25 26 var thisID = $(this).attr("id"); 27 console.log(thisID); 28 doingLink = thisID; 29 30 if (typeof wpLink !== 'undefined') { 31 var current_url = $('#' + doingLink + '-url').val(); 32 var current_title = $('#' + doingLink + '-title').val(); 33 var current_target = $('#' + doingLink + '-target').val(); 34 35 // save any existing default initialization 36 wplink_defaults = wpLink.setDefaultValues; 37 38 // initialize with current URL and title 39 wpLink.setDefaultValues = function () { 40 // set the current title and URL 41 var $text_inputs = $('#wp-link').find('input[type=text]'); 42 $($text_inputs[1]).val(current_title); 43 $($text_inputs[0]).val(current_url); 44 45 // target a blank page? 46 var $checkbox_inputs = $('#wp-link').find('input[type=checkbox]'); 47 $checkbox_inputs.first().prop('checked', (current_target === '_blank')); 48 }; 49 wpLink.open(thisID); // open the link popup 50 } 51 52 return false; 53 }); 54 55 $el.on('click', 'a.link-remove-btn', function(event) 56 { 57 var thisID = $(this).attr("id").replace("-remove", ""); 12 58 doingLink = thisID; 13 59 14 wpActiveEditor = true; // we need to override this var as the link dialogue is expecting an actual wp_editor instance 15 //console.log(wpLink); 16 wpLink.open(); // open the link popup 60 $('#' + doingLink + '-url').val(''); 61 $('#' + doingLink + '-title').val(''); 62 $('#' + doingLink + '-target').val(''); 63 64 $('#' + doingLink + '-none').show(); 65 $('#' + doingLink + '-exists').hide(); 66 67 if (typeof acf._e != 'undefined') 68 { 69 $('#' + doingLink).html(acf._e('link_picker', 'insert_link')); 70 } 71 else 72 { 73 $('#' + doingLink).html(translations.insert_link); 74 } 75 $('#' + doingLink + '-remove').fadeOut('fast'); 76 77 trap_events(event); 17 78 return false; 18 79 }); 19 20 jQuery('body').on('click', '#wp-link-submit', function(event) 21 { 22 if (doingLink != '') 80 81 // initizialize wplink button handlers, but only do it once 82 if (!modal_bound) { 83 bind_wplink_handlers(); 84 modal_bound = true; 85 } 86 } 87 88 function reset_wplink() { 89 wpLink.textarea = $('body'); // to close the link dialogue, it is again expecting an wp_editor instance, so you need to give it something to set focus back to. In this case, I'm using body, but the textfield with the URL would be fine 90 wpLink.close();// close the dialogue 91 92 // restore wplink default initialization 93 wpLink.setDefaultValues = wplink_defaults; 94 doingLink = ''; 95 } 96 97 function bind_wplink_handlers() { 98 $('body').on('click', '#wp-link-submit', function(event) 99 { 100 // ignore this handler if we're not running a link-picker 101 if (doingLink !== '') 23 102 { 24 103 var linkAtts = wpLink.getAttrs(); // the links attributes (href, target) are stored in an object, which can be access via wpLink.getAttrs() 25 26 //console.log('#' + doingLink + '-url'); 27 //console.log(jQuery('#' + doingLink + '-url').length); 28 29 jQuery('#' + doingLink + '-url').val(linkAtts.href); 30 jQuery('#' + doingLink + '-title').val(linkAtts.title); 31 jQuery('#' + doingLink + '-target').val(linkAtts.target); 32 33 jQuery('#' + doingLink + '-url-label').html('<a href="' + linkAtts.href + '" target="_blank">' + linkAtts.href + '</a>'); 34 jQuery('#' + doingLink + '-title-label').html(linkAtts.title); 35 if (typeof acf._e != 'undefined') 36 { 37 jQuery('#' + doingLink + '-target-label').html((linkAtts.target == '_blank') ? acf._e('link_picker', 'yes') : acf._e('link_picker', 'no')); 38 } 39 else 40 { 41 jQuery('#' + doingLink + '-target-label').html((linkAtts.target == '_blank') ? 'Yes' : 'No'); 42 } 43 44 jQuery('#' + doingLink + '-none').hide(); 45 jQuery('#' + doingLink + '-exists').show(); 46 47 if (typeof acf._e != 'undefined') 48 { 49 jQuery('#' + doingLink).html(acf._e('link_picker', 'edit_link')); 50 } 51 else 52 { 53 jQuery('#' + doingLink).html('Edit Link'); 54 } 55 jQuery('#' + doingLink + '-remove').fadeIn('fast'); 56 57 wpLink.textarea = jQuery('body'); // to close the link dialogue, it is again expecting an wp_editor instance, so you need to give it something to set focus back to. In this case, I'm using body, but the textfield with the URL would be fine 58 wpLink.close();// close the dialogue 59 60 //trap any events 61 event.preventDefault ? event.preventDefault() : event.returnValue = false; 62 event.stopPropagation(); 63 104 // title is no longer included (as of 4.2) 105 if (!('title' in linkAtts)) { 106 linkAtts.title = $("#wp-link-text").val(); 107 } 108 109 $('#' + doingLink + '-url').val(linkAtts.href); 110 $('#' + doingLink + '-title').val(linkAtts.title); 111 $('#' + doingLink + '-target').val(linkAtts.target); 112 113 $('#' + doingLink + '-url-label').html('<a href="' + linkAtts.href + '" target="_blank">' + linkAtts.href + '</a>'); 114 $('#' + doingLink + '-title-label').html(linkAtts.title); 115 116 if (typeof acf._e != 'undefined') 117 { 118 $('#' + doingLink + '-target-label').html((linkAtts.target == '_blank') ? acf._e('link_picker', 'yes') : acf._e('link_picker', 'no')); 119 } 120 else 121 { 122 $('#' + doingLink + '-target-label').html((linkAtts.target == '_blank') ? translations.yes : translations.no); 123 } 124 125 $('#' + doingLink + '-none').hide(); 126 $('#' + doingLink + '-exists').show(); 127 128 if (typeof acf._e != 'undefined') 129 { 130 $('#' + doingLink).html(acf._e('link_picker', 'edit_link')); 131 } 132 else 133 { 134 $('#' + doingLink).html(translations.edit_link); 135 } 136 137 $('#' + doingLink + '-remove').fadeIn('fast'); 138 139 trap_events(event); 140 reset_wplink(); 64 141 return false; 65 142 } 66 doingLink = ''; 67 }); 68 69 jQuery('body').on('click', '.link-remove-btn', function(event) 70 { 71 var thisID = jQuery(this).attr("id").replace("-remove", ""); 72 doingLink = thisID; 73 74 jQuery('#' + doingLink + '-url').val(''); 75 jQuery('#' + doingLink + '-title').val(''); 76 jQuery('#' + doingLink + '-target').val(''); 77 78 jQuery('#' + doingLink + '-none').show(); 79 jQuery('#' + doingLink + '-exists').hide(); 80 81 if (typeof acf._e != 'undefined') 82 { 83 jQuery('#' + doingLink).html(acf._e('link_picker', 'insert_link')); 84 } 85 else 86 { 87 jQuery('#' + doingLink).html('Insert Link'); 88 } 89 jQuery('#' + doingLink + '-remove').fadeOut('fast'); 90 91 doingLink = ''; 92 93 return false; 94 }); 95 96 jQuery('body').on('click', '#wp-link-cancel a', function(event) 97 { 98 wpLink.textarea = jQuery('body'); 99 wpLink.close(); 100 101 event.preventDefault ? event.preventDefault() : event.returnValue = false; 102 event.stopPropagation(); 103 doingLink = ''; 104 return false; 105 }); 106 107 jQuery('body').on('click', '#wp-link-close', function(event) 108 { 109 wpLink.textarea = jQuery('body'); 110 wpLink.close(); 111 112 event.preventDefault ? event.preventDefault() : event.returnValue = false; 113 event.stopPropagation(); 114 doingLink = ''; 115 return false; 116 }); 117 118 } 119 120 if( typeof acf.add_action !== 'undefined' ) { 121 122 /* 123 * ready append (ACF5) 124 * 125 * These are 2 events which are fired during the page load 126 * ready = on page load similar to $(document).ready() 127 * append = on new DOM elements appended via repeater field 128 * 129 * @type event 130 * @date 20/07/13 131 * 132 * @param $el (jQuery selection) the jQuery element which contains the ACF fields 133 * @return n/a 134 */ 135 136 acf.add_action('ready append', function( $el ){ 143 }); 144 145 146 $('body').on('click', '#wp-link-close, #wp-link-cancel a', function(event) 147 { 148 // ignore this handler if we're not running a link-picker 149 if (doingLink !== '') 150 { 151 trap_events(event); 152 reset_wplink(); 153 return false; 154 } 155 }); 156 } 157 158 if( typeof acf.add_action !== 'undefined' ) { 159 160 /* 161 * ready append (ACF5) 162 * 163 * These are 2 events which are fired during the page load 164 * ready = on page load similar to $(document).ready() 165 * append = on new DOM elements appended via repeater field 166 * 167 * @type event 168 * @date 20/07/13 169 * 170 * @param $el (jQuery selection) the jQuery element which contains the ACF fields 171 * @return n/a 172 */ 173 174 acf.add_action('ready append', function( $el ){ 175 176 // search $el for fields of type 'FIELD_NAME' 177 acf.get_fields({ type : 'link_picker'}, $el).each(function(){ 178 initialize_field( $(this) ); 179 }); 180 181 }); 182 183 } else { 184 185 /* 186 * acf/setup_fields (ACF4) 187 * 188 * This event is triggered when ACF adds any new elements to the DOM. 189 * 190 * @type function 191 * @since 1.0.0 192 * @date 01/01/12 193 * 194 * @param event e: an event object. This can be ignored 195 * @param Element postbox: An element which contains the new HTML 196 * 197 * @return n/a 198 */ 199 200 $(document).live('acf/setup_fields', function(e, postbox){ 201 202 $(postbox).find('.field[data-field_type="link_picker"]').each(function(){ 203 initialize_field( $(this) ); 204 }); 137 205 138 // search $el for fields of type 'FIELD_NAME' 139 acf.get_fields({ type : 'link_picker'}, $el).each(function(){ 140 141 initialize_field( $(this) ); 142 143 }); 144 145 }); 146 147 } else { 148 149 /* 150 * acf/setup_fields (ACF4) 151 * 152 * This event is triggered when ACF adds any new elements to the DOM. 153 * 154 * @type function 155 * @since 1.0.0 156 * @date 01/01/12 157 * 158 * @param event e: an event object. This can be ignored 159 * @param Element postbox: An element which contains the new HTML 160 * 161 * @return n/a 162 */ 163 164 $(document).live('acf/setup_fields', function(e, postbox){ 165 166 $(postbox).find('.field[data-field_type="link_picker"]').each(function(){ 167 168 initialize_field( $(this) ); 169 170 }); 171 172 }); 173 174 } 206 $(postbox).find('.sub_field[data-field_type="link_picker"]').each(function(){ 207 initialize_field( $(this) ); 208 }); 209 210 }); 211 212 } 175 213 176 214 })(jQuery); -
advanced-custom-fields-link-picker-field/trunk/readme.txt
r966895 r1333592 1 1 === Advanced Custom Fields: Link Picker Field === 2 2 3 Contributors: BIOSTALL 3 4 Tags: acf, advanced custom fields, link picker, link chooser, acf link picker 4 5 Requires at least: 3.5 5 Tested up to: 3.9.26 Tested up to: 4.4.1 6 7 Stable tag: trunk 7 8 License: GPLv2 or later … … 12 13 == Description == 13 14 14 This add on for the already established Advanced Custom Fields plugin adds a new field type called 'Link Picker' which allows the user to enter a URL, or select from the existing pages. 15 This add on for the already established Advanced Custom Fields plugin adds a new field type called 'Link Picker' which allows the user to enter a URL, or select from the existing pages. It is a thin wrapper around the link selector included with the WYSIWYG field editor. 15 16 16 Utilising the existing modal dialog popup from the WYSIWYG, users will already be familiar with how it works.17 This plugin is forked from the plugin of the same name hosted at https://github.com/BIOSTALL/ACF-Link-Picker-Field. This version is hosted at https://github.com/ahebrank/ACF-Link-Picker-Field and issues and PRs should be submitted there. 17 18 18 19 Note: Advanced Custom Fields must be installed for this add-on to work. 19 20 20 = Compatibility=21 == Compatibility == 21 22 22 23 This ACF field type is compatible with: … … 31 32 3. Create a new field via ACF and select the Link Picker type 32 33 34 == Usage == 35 33 36 When outputting the link selection on the front end, you will have three object elements available: 34 37 … … 39 42 Code example: 40 43 41 `$mylink = get_field('mylink'); 42 var_dump($mylink); 44 `$mylink = get_field('mylink');` 45 `var_dump($mylink);` 43 46 44 /*45 47 Outputs: 46 48 47 array(3) {49 `array(3) { 48 50 ["url"]=> 49 51 string(31) "http://mysite.com/selected/url/" … … 52 54 ["target"]=> 53 55 string(6) "_blank" 54 }*/` 55 56 == Screenshots == 57 58 1. Selecting the 'Link Picker' field type when setting up the field 59 2. No link selected. The user can click 'Insert Link' 60 3. Presented with the standard and familiar popup dialog box 61 4. Once selected the user can see the current link, edit it and remove it 56 }` 62 57 63 58 == Changelog == 59 60 = 1.1.1 = 61 * Added PT translation support from [alvarogois](https://github.com/alvarogois) 62 * Bumped compatibility information 63 64 = 1.1 = 65 * Bump version, preserve _blank target if set from [philmprice](https://github.com/philmprice) 66 67 = 1.0.3 = 68 * Translation support from [m0n0mind](https://github.com/m0n0mind) 69 70 = 1.0.2 = 71 * Forked by ahebrank and refactored, updated for compatibility with WP 4.2 64 72 65 73 = 1.0.1 = … … 69 77 = 1.0.0 = 70 78 * Initial Release. 79 80 == Upgrade Notice == 81 82 = 1.1 = 83 Adds target attribute preservation 84 85 = 1.0.3 = 86 Adds German translation support 87 88 = 1.0.2 = 89 Adds WP 4.2+ support
Note: See TracChangeset
for help on using the changeset viewer.