- Timestamp:
- 02/08/2016 04:52:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r10434 r10557 129 129 */ 130 130 protected $allow_custom_visibility; 131 132 /** 133 * Whether values from this field are autolinked to directory searches. 134 * 135 * @since 2.5.0 136 * 137 * @var bool 138 */ 139 public $do_autolink; 131 140 132 141 /** … … 793 802 } 794 803 804 /** 805 * Get whether the field values should be auto-linked to a directory search. 806 * 807 * Lazy-loaded to reduce overhead. 808 * 809 * Defaults to true for multi and default fields, false for single fields. 810 * 811 * @since 2.5.0 812 * 813 * @return bool 814 */ 815 public function get_do_autolink() { 816 if ( ! isset( $this->do_autolink ) ) { 817 $do_autolink = bp_xprofile_get_meta( $this->id, 'field', 'do_autolink' ); 818 819 if ( '' === $do_autolink ) { 820 $this->do_autolink = $this->is_default_field() || $this->type_obj->supports_options; 821 } else { 822 $this->do_autolink = 'on' === $do_autolink; 823 } 824 } 825 826 return $this->do_autolink; 827 } 828 795 829 /* Static Methods ********************************************************/ 796 830 … … 1138 1172 // Output the field visibility metaboxes. 1139 1173 $this->visibility_metabox(); 1174 1175 // Output the autolink metabox. 1176 $this->autolink_metabox(); 1177 1140 1178 1141 1179 /** … … 1412 1450 1413 1451 /** 1452 * Private method used to output autolink metabox. 1453 * 1454 * @since 2.5.0 1455 * 1456 * @return void If default field id 1. 1457 */ 1458 private function autolink_metabox() { 1459 1460 // Default field cannot have custom visibility. 1461 if ( true === $this->is_default_field() ) { 1462 return; 1463 } 1464 1465 ?> 1466 1467 <div class="postbox"> 1468 <h2><label for="do-autolink"><?php esc_html_e( 'Autolink', 'buddypress' ); ?></label></h2> 1469 <div class="inside"> 1470 <p class="description"><?php esc_html_e( 'On user profiles, link this field to a search of the Members directory, using the field value as a search term:', 'buddypress' ); ?></p> 1471 1472 <p> 1473 <label> 1474 <select name="do_autolink" id="do-autolink"> 1475 <option value="on" <?php selected( $this->get_do_autolink() ); ?>><?php esc_html_e( 'Enabled', 'buddypress' ); ?></option> 1476 <option value="" <?php selected( $this->get_do_autolink(), false ); ?>><?php esc_html_e( 'Disabled', 'buddypress' ); ?></option> 1477 </select> 1478 </label> 1479 </p> 1480 </div> 1481 </div> 1482 1483 <?php 1484 } 1485 1486 /** 1414 1487 * Output the metabox for setting what type of field this is. 1415 1488 *
Note: See TracChangeset
for help on using the changeset viewer.