Changeset 1110271
- Timestamp:
- 03/11/2015 11:21:59 AM (11 years ago)
- Location:
- flickr-field-for-advanced-custom-fields/trunk
- Files:
-
- 5 edited
-
acf-flickr-v4.php (modified) (6 diffs)
-
acf-flickr-v5.php (modified) (5 diffs)
-
js/flickr-acf4.js (modified) (3 diffs)
-
js/flickr-acf5.js (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v4.php
r1083026 r1110271 29 29 'flickr_content_type' => 'sets', 30 30 'flickr_sets_amount' => '9999', 31 'flickr_max_selected' => '0', 31 32 'flickr_thumb_size' => 'square', 32 33 'flickr_large_size' => 'large_1024', … … 147 148 ?> 148 149 </td> 150 </tr> 151 <tr class="field_option field_option_<?php echo $this->name; ?>"> 152 <td class="label"> 153 <label><?php _e( 'Max selectable amount', 'acf-flickr' );?></label> 154 <p class="description"><?php _e('What\'s the maximum amount to be attached to a post? Using 0 is default (and unlimited).', 'acf-flickr');?></p> 155 </td> 156 <td> 157 <?php 158 do_action('acf/create_field', array( 159 'type' => 'text', 160 'name' => 'fields['.$key.'][flickr_max_selected]', 161 'value' => $field['flickr_max_selected'], 162 )); 163 ?> 164 </td> 149 165 </tr> 150 166 <tr class="field_option field_option_<?php echo $this->name; ?>"> … … 193 209 </tr> 194 210 211 195 212 <tr class="field_option field_option_<?php echo $this->name; ?>"> 196 213 <td class="label"> … … 269 286 $f->enableCache('fs', $cache_dir, $duration); 270 287 } 271 272 // Include fields.css from the ACF plugin for some more styling273 wp_register_style('fields-css',get_bloginfo('wpurl'). '/wp-content/plugins/advanced-custom-fields/css/fields.css');274 wp_enqueue_style('fields-css');275 288 276 289 $field['choices'] = array(); … … 305 318 foreach($data as $key => $flickr) { 306 319 ?> 307 <tr class="field_label flickr_row <?php if (i n_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>">320 <tr class="field_label flickr_row <?php if (isset($flickr['id']) && in_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>"> 308 321 <td class="label set_image"> 309 322 <?php if ($field['flickr_content_type'] == 'sets'): ?> … … 395 408 // html 396 409 if (!isset($multiple)) { $multiple = ''; } 397 echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';410 echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' data-max-selectable="'. $field['flickr_max_selected'] .'" data-flickr-type="'. $field['flickr_content_type'] .'">'; 398 411 399 412 // null -
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php
r1083026 r1110271 48 48 'flickr_content_type' => 'sets', 49 49 'flickr_sets_amount' => '9999', 50 'flickr_max_selected' => '0', 50 51 'flickr_thumb_size' => 'square', 51 52 'flickr_large_size' => 'large_1024', … … 120 121 )); 121 122 123 acf_render_field_setting( $field, array( 124 'label' => __('Max selectable amount','acf-flickr'), 125 'instructions' => __('What\'s the maximum amount to be attached to a post? Using 0 is default (and unlimited).','acf-flickr'), 126 'type' => 'text', 127 'name' => 'flickr_max_selected', 128 )); 129 122 130 $cache_dir = dirname(__FILE__) . '/cache'; 123 131 if (! is_writeable($cache_dir)) { … … 211 219 $f->enableCache('fs', $cache_dir, $duration); 212 220 } 213 214 // Include fields.css from the ACF plugin for some more styling215 wp_register_style('fields-css',get_bloginfo('wpurl'). '/wp-content/plugins/advanced-custom-fields/css/fields.css');216 wp_enqueue_style('fields-css');217 221 218 222 $field['choices'] = array(); … … 247 251 foreach($data as $key => $flickr) { 248 252 ?> 249 <tr class="field_label flickr_row <?php if (i n_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>">253 <tr class="field_label flickr_row <?php if (isset($flickr['id']) && in_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>"> 250 254 <td class="label set_image"> 251 255 <?php if ($field['flickr_content_type'] == 'sets'): ?> … … 336 340 // html 337 341 if (!isset($multiple)) { $multiple = ''; } 338 echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';342 echo '<select id="' . $field['name'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' data-max-selectable="'. $field['flickr_max_selected'] .'" data-flickr-type="'. $field['flickr_content_type'] .'" >'; 339 343 340 344 // null -
flickr-field-for-advanced-custom-fields/trunk/js/flickr-acf4.js
r1083027 r1110271 2 2 3 3 function initialize_flickrfield( $el ) { 4 var max_selected_amount = $('select', $el).data('max-selectable'); 5 if(max_selected_amount == '') { 6 max_selected_amount = 0; 7 } 8 var flickr_type = $('select', $el).data('flickr-type'); 4 9 5 10 function fill_input_value() { … … 38 43 $('.flickr_row', $el).click(function(e) { 39 44 e.preventDefault(); 45 40 46 // Deselect if active 41 47 if ($(this).hasClass('active-row')) { … … 43 49 } 44 50 else { 51 // Check if the maximum selectable amount of items has been passed 52 if(max_selected_amount != 0 && $('.active-row', $el).length >= max_selected_amount) { 53 alert('The maximum selectable amount of ' + flickr_type + ' is ' + max_selected_amount + '.'); 54 return; 55 } 45 56 $(this).addClass('active-row'); 46 57 } -
flickr-field-for-advanced-custom-fields/trunk/js/flickr-acf5.js
r1083026 r1110271 2 2 3 3 function initialize_flickrfield( $el ) { 4 var max_selected_amount = $('select', $el).data('max-selectable'); 5 if(max_selected_amount == '') { 6 max_selected_amount = 0; 7 } 8 var flickr_type = $('select', $el).data('flickr-type'); 4 9 5 10 function fill_input_value() { … … 13 18 secret: $(this).attr('data-flickr-secret'), 14 19 farm: $(this).attr('data-flickr-farm'), 15 title: $(this).attr('data-flickr-title'), 20 title: $(this).attr('data-flickr-title'), 16 21 original_url: $(this).attr('data-flickr-original-url') 17 22 }); … … 38 43 $('.flickr_row', $el).click(function(e) { 39 44 e.preventDefault(); 45 40 46 // Deselect if active 41 47 if ($(this).hasClass('active-row')) { … … 43 49 } 44 50 else { 51 // Check if the maximum selectable amount of items has been passed 52 if(max_selected_amount != 0 && $('.active-row', $el).length >= max_selected_amount) { 53 alert('The maximum selectable amount of ' + flickr_type + ' is ' + max_selected_amount + '.'); 54 return; 55 } 45 56 $(this).addClass('active-row'); 46 57 } -
flickr-field-for-advanced-custom-fields/trunk/readme.txt
r1087014 r1110271 3 3 Tags: flickr, acf, custom, fields, photostream, photosets 4 4 Requires at least: 3.0.1 5 Tested up to: 4.1 6 Stable tag: 1.0. 45 Tested up to: 4.1.1 6 Stable tag: 1.0.5 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 56 56 == Changelog == 57 57 58 = 1.0.5 = 59 * Added feature to limit the maximum selectable amount of sets/photos 60 58 61 = 1.0.4 = 59 62 * Added possibility to display original format of the photo
Note: See TracChangeset
for help on using the changeset viewer.