WordPress.org

Plugin Directory

Changeset 583225


Ignore:
Timestamp:
08/08/12 20:23:51 (21 months ago)
Author:
Omicron7
Message:

ACF Taxonomy Field 1.4 Release

Location:
advanced-custom-fields-taxonomy-field-add-on/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • advanced-custom-fields-taxonomy-field-add-on/trunk/languages/acf-taxonomy-field.pot

    r577744 r583225  
    44msgstr "" 
    55"Project-Id-Version:  \n" 
    6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/acf-taxonomy-field\n" 
    7 "POT-Creation-Date: 2012-07-26 15:53:40+00:00\n" 
     6"Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-custom-fields-" 
     7"taxonomy-field-add-on\n" 
     8"POT-Creation-Date: 2012-08-08 20:13:28+00:00\n" 
    89"MIME-Version: 1.0\n" 
    910"Content-Type: text/plain; charset=UTF-8\n" 
     
    1314"Language-Team: LANGUAGE <LL@li.org>\n" 
    1415 
    15 #: taxonomy-field.php:216 taxonomy-field.php:307 
     16#: taxonomy-field.php:219 taxonomy-field.php:311 
    1617msgid "Taxonomy" 
    1718msgstr "" 
    1819 
    19 #: taxonomy-field.php:308 
     20#: taxonomy-field.php:312 
    2021msgid "Select the taxonomy to display." 
    2122msgstr "" 
    2223 
    23 #: taxonomy-field.php:323 
     24#: taxonomy-field.php:327 
    2425msgid "Input Method" 
    2526msgstr "" 
    2627 
    27 #: taxonomy-field.php:334 
     28#: taxonomy-field.php:338 
    2829msgid "Select" 
    2930msgstr "" 
    3031 
    31 #: taxonomy-field.php:335 
     32#: taxonomy-field.php:339 
    3233msgid "Multi-Select" 
    3334msgstr "" 
    3435 
    35 #: taxonomy-field.php:336 
     36#: taxonomy-field.php:340 
    3637msgid "Hierarchical Checkboxes" 
    3738msgstr "" 
    3839 
    39 #: taxonomy-field.php:344 
     40#: taxonomy-field.php:348 
    4041msgid "Set Post Terms" 
    4142msgstr "" 
    4243 
    43 #: taxonomy-field.php:345 
     44#: taxonomy-field.php:349 
    4445msgid "" 
    4546"Add the selected term(s) to the post. The current post must support the " 
     
    4748msgstr "" 
    4849 
    49 #: taxonomy-field.php:355 
     50#: taxonomy-field.php:359 
    5051msgid "Not Set" 
    5152msgstr "" 
    5253 
    53 #: taxonomy-field.php:356 
     54#: taxonomy-field.php:360 
    5455msgid "Append Terms" 
    5556msgstr "" 
    5657 
    57 #: taxonomy-field.php:357 
     58#: taxonomy-field.php:361 
    5859msgid "Override Terms" 
    5960msgstr "" 
    6061 
    61 #: taxonomy-field.php:365 
     62#: taxonomy-field.php:369 
     63msgid "Use Post Terms for Field Value" 
     64msgstr "" 
     65 
     66#: taxonomy-field.php:370 
     67msgid "Pre-populate the field value using the terms assigned to the post." 
     68msgstr "" 
     69 
     70#: taxonomy-field.php:378 
     71msgid "Pre-populate the field value" 
     72msgstr "" 
     73 
     74#: taxonomy-field.php:381 
     75msgid "" 
     76"Setting this option will cause the field value as well as the get_value() " 
     77"api call to use the terms assigned to the post as the value of the field. " 
     78"Enabling this option when using a Repeater or the same taxonomy multiple " 
     79"times in an ACF group will cause all the taxonomy fields have the same " 
     80"values, regardless of the values selected." 
     81msgstr "" 
     82 
     83#: taxonomy-field.php:386 
    6284msgid "Return Value" 
    6385msgstr "" 
    6486 
    65 #: taxonomy-field.php:366 
     87#: taxonomy-field.php:387 
    6688msgid "Choose the field value type returned by API calls." 
    6789msgstr "" 
    6890 
    69 #: taxonomy-field.php:376 
     91#: taxonomy-field.php:397 
    7092msgid "Links" 
    7193msgstr "" 
    7294 
    73 #: taxonomy-field.php:377 
     95#: taxonomy-field.php:398 
    7496msgid "Objects" 
    7597msgstr "" 
    7698 
    77 #: taxonomy-field.php:378 
     99#: taxonomy-field.php:399 
    78100msgid "Term IDs" 
    79101msgstr "" 
    80102 
    81 #: taxonomy-field.php:386 
     103#: taxonomy-field.php:407 
    82104msgid "Multi-Select Size" 
    83105msgstr "" 
    84106 
    85 #: taxonomy-field.php:387 
     107#: taxonomy-field.php:408 
    86108msgid "The number of terms to show at once in a multi-select." 
    87109msgstr "" 
  • advanced-custom-fields-taxonomy-field-add-on/trunk/readme.txt

    r578107 r583225  
    44Requires at least: 3.2 
    55Tested up to: 3.4.1 
    6 Stable tag: 1.3.1 
     6Stable tag: 1.4 
    77 
    88Adds a Taxonomy Field to Advanced Custom Fields. Select one or more taxonomy terms and assign them to the post. 
     
    5757== Changelog == 
    5858 
     59= 1.4 = 
     60* Added option to use the terms assigned to the post as the field value. 
     61 
    5962= 1.3.1 = 
    6063* Fixed undefined class constant FIELD_NAME issue. Props dmeehan1968 
  • advanced-custom-fields-taxonomy-field-add-on/trunk/taxonomy-field.php

    r578107 r583225  
    66* Author:      Brian Zoetewey 
    77* Author URI:  https://github.com/GCX 
    8 * Version:     1.3.1 
     8* Version:     1.4 
    99* Text Domain: acf-taxonomy-field 
    1010* Domain Path: /languages/ 
     
    4949 *  
    5050 * @author Brian Zoetewey <brian.zoetewey@ccci.org> 
    51  * @version 1.3.1 
     51 * @version 1.4 
    5252 */ 
    5353class ACF_Taxonomy_Field extends acf_Field { 
     
    100100     */ 
    101101    const FIELD_RETURN_TYPE = 'return_value_type'; 
     102 
     103    /** 
     104     * Field use post terms for value 
     105     * @var string 
     106     */ 
     107    const FIELD_USE_TERMS = 'use_post_terms'; 
    102108 
    103109    /** 
     
    224230        $field[ self::FIELD_INPUT_TYPE ] = ( array_key_exists( self::FIELD_INPUT_TYPE, $field ) && isset( $field[ self::FIELD_INPUT_TYPE ] ) ) ? $field[ self::FIELD_INPUT_TYPE ] : self::INPUT_TYPE_SELECT; 
    225231        $field[ self::FIELD_INPUT_SIZE ] = ( array_key_exists( self::FIELD_INPUT_SIZE, $field ) && isset( $field[ self::FIELD_INPUT_SIZE ] ) ) ? (int) $field[ self::FIELD_INPUT_SIZE ] : 5; 
     232        $field[ self::FIELD_USE_TERMS ]  = ( array_key_exists( self::FIELD_USE_TERMS, $field ) && isset( $field[ self::FIELD_USE_TERMS ] ) ) ? (int) $field[ self::FIELD_USE_TERMS ] : 0; //default false 
    226233 
    227234        $field[ self::FIELD_SET_TERMS ]  = ( array_key_exists( self::FIELD_SET_TERMS, $field ) && isset( $field[ self::FIELD_SET_TERMS ] ) ) ? $field[ self::FIELD_SET_TERMS ] : self::SET_TERMS_NOT_SET; 
     
    360367            <tr class="field_option field_option_<?php echo $this->name; ?>"> 
    361368                <td class="label"> 
     369                    <label><?php _e( 'Use Post Terms for Field Value' , $this->l10n_domain ); ?></label> 
     370                    <p class="description"><?php _e( 'Pre-populate the field value using the terms assigned to the post.', $this->l10n_domain ); ?></p> 
     371                </td> 
     372                <td> 
     373                    <?php 
     374                        $this->parent->create_field( array( 
     375                            'type'    => 'true_false', 
     376                            'name'    => 'fields[' . $key . '][' . self::FIELD_USE_TERMS . ']', 
     377                            'value'   => $field[ self::FIELD_USE_TERMS ], 
     378                            'message' => __( 'Pre-populate the field value', $this->l10n_domain ), 
     379                        ) ); 
     380                    ?> 
     381                    <p class="description"><?php _e( 'Setting this option will cause the field value as well as the get_value() api call to use the terms assigned to the post as the value of the field. Enabling this option when using a Repeater or the same taxonomy multiple times in an ACF group will cause all the taxonomy fields have the same values, regardless of the values selected.', $this->l10n_domain ); ?></p> 
     382                </td> 
     383            </tr> 
     384            <tr class="field_option field_option_<?php echo $this->name; ?>"> 
     385                <td class="label"> 
    362386                    <label><?php _e( 'Return Value', $this->l10n_domain ); ?></label> 
    363387                    <p class="description"><?php _e( 'Choose the field value type returned by API calls.', $this->l10n_domain ); ?></p> 
     
    425449     * @param int $post_id 
    426450     * @param array $field 
    427      * @return mixed   
     451     * @return array 
    428452     */ 
    429453    public function get_value( $post_id, $field ) { 
    430         $value = (array) parent::get_value( $post_id, $field ); 
     454        $value = ( $field[ self::FIELD_USE_TERMS ] ) ? 
     455            wp_get_object_terms( $post_id, $field[ self::FIELD_TAXONOMY ], array( 'fields' => 'ids' ) ) : 
     456            parent::get_value( $post_id, $field ); 
     457        $value = is_array( $value ) ? $value : array(); 
    431458        return $value; 
    432459    } 
     
    442469    public function get_value_for_api( $post_id, $field ) { 
    443470        $this->set_field_defaults( $field ); 
    444          
     471 
    445472        $value = parent::get_value_for_api( $post_id, $field ); 
    446473        $value = is_array( $value ) ? $value : array(); 
Note: See TracChangeset for help on using the changeset viewer.