| @@ -36,18 +36,27 @@ | ||
| 36 | 36 | * @param string $type |
| 37 | 37 | */ |
| 38 | 38 | public function __construct( $field = 0, $type = '' ) { |
| 39 | 39 | parent::__construct( $field, $type ); |
| 40 | + $this->register_sub_fields( self::get_part_labels() ); | |
| 41 | + } | |
| 40 | 42 | |
| 41 | - $this->register_sub_fields( | |
| 42 | - array( | |
| 43 | - 'line1' => __( 'Line 1', 'formidable' ), | |
| 44 | - 'line2' => __( 'Line 2', 'formidable' ), | |
| 45 | - 'city' => __( 'City', 'formidable' ), | |
| 46 | - 'state' => __( 'State/Province', 'formidable' ), | |
| 47 | - 'zip' => __( 'Zip/Postal', 'formidable' ), | |
| 48 | - 'country' => __( 'Country', 'formidable' ), | |
| 49 | - ) | |
| 43 | + /** | |
| 44 | + * Gets the label for each part of an address, keyed by the value the part is | |
| 45 | + * shown with in a shortcode, like [25 show=city]. | |
| 46 | + * | |
| 47 | + * @since 6.35 | |
| 48 | + * | |
| 49 | + * @return array | |
| 50 | + */ | |
| 51 | + public static function get_part_labels() { | |
| 52 | + return array( | |
| 53 | + 'line1' => __( 'Line 1', 'formidable' ), | |
| 54 | + 'line2' => __( 'Line 2', 'formidable' ), | |
| 55 | + 'city' => __( 'City', 'formidable' ), | |
| 56 | + 'state' => __( 'State/Province', 'formidable' ), | |
| 57 | + 'zip' => __( 'Zip/Postal', 'formidable' ), | |
| 58 | + 'country' => __( 'Country', 'formidable' ), | |
| 50 | 59 | ); |
| 51 | 60 | } |
| 52 | 61 | |
| 53 | 62 | protected function field_settings_for_type() { |