@@ 448-462 (lines=15) @@ | ||
445 | * |
|
446 | * @param string $label If null, the label will be generated from the field name |
|
447 | **/ |
|
448 | public function set_label( $label ) { |
|
449 | // Try to guess field label from it's name |
|
450 | if ( is_null( $label ) ) { |
|
451 | // remove the leading underscore(if it's there) |
|
452 | $label = preg_replace( '~^_~', '', $this->name ); |
|
453 | ||
454 | // remove the leading "crb_"(if it's there) |
|
455 | $label = preg_replace( '~^crb_~', '', $label ); |
|
456 | ||
457 | // split the name into words and make them capitalized |
|
458 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
459 | } |
|
460 | ||
461 | $this->label = $label; |
|
462 | } |
|
463 | ||
464 | /** |
|
465 | * Return field label. |
@@ 75-89 (lines=15) @@ | ||
72 | return $group_data; |
|
73 | } |
|
74 | ||
75 | public function set_label( $label ) { |
|
76 | // Try to guess field label from it's name |
|
77 | if ( is_null( $label ) ) { |
|
78 | // remove the leading underscore(if it's there) |
|
79 | $label = preg_replace( '~^_~', '', $this->name ); |
|
80 | ||
81 | // remove the leading "crb_"(if it's there) |
|
82 | $label = preg_replace( '~^crb_~', '', $label ); |
|
83 | ||
84 | // split the name into words and make them capitalized |
|
85 | $label = ucwords( str_replace( '_', ' ', $label ) ); |
|
86 | } |
|
87 | ||
88 | $this->label = $label; |
|
89 | } |
|
90 | ||
91 | public function get_label() { |
|
92 | return $this->label; |