| @@ 152-166 (lines=15) @@ | ||
| 149 | * |
|
| 150 | * @param string $label If null, the label will be generated from the group name |
|
| 151 | */ |
|
| 152 | public function set_label( $label ) { |
|
| 153 | // Try to guess field label from it's name |
|
| 154 | if ( is_null( $label ) ) { |
|
| 155 | // remove the leading underscore(if it's there) |
|
| 156 | $label = preg_replace( '~^_~', '', $this->name ); |
|
| 157 | ||
| 158 | // remove the leading "crb_"(if it's there) |
|
| 159 | $label = preg_replace( '~^crb_~', '', $label ); |
|
| 160 | ||
| 161 | // split the name into words and make them capitalized |
|
| 162 | $label = ucwords( str_replace( '_', ' ', $label ) ); |
|
| 163 | } |
|
| 164 | ||
| 165 | $this->label = $label; |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * Label attribute getter. |
|
| @@ 647-661 (lines=15) @@ | ||
| 644 | * |
|
| 645 | * @param string $label If null, the label will be generated from the field name |
|
| 646 | **/ |
|
| 647 | public function set_label( $label ) { |
|
| 648 | // Try to guess field label from it's name |
|
| 649 | if ( is_null( $label ) ) { |
|
| 650 | // remove the leading underscore(if it's there) |
|
| 651 | $label = preg_replace( '~^_~', '', $this->name ); |
|
| 652 | ||
| 653 | // remove the leading "crb_"(if it's there) |
|
| 654 | $label = preg_replace( '~^crb_~', '', $label ); |
|
| 655 | ||
| 656 | // split the name into words and make them capitalized |
|
| 657 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
| 658 | } |
|
| 659 | ||
| 660 | $this->label = $label; |
|
| 661 | } |
|
| 662 | ||
| 663 | /** |
|
| 664 | * Return the field help text |
|