| @@ 157-171 (lines=15) @@ | ||
| 154 | * |
|
| 155 | * @param string $label If null, the label will be generated from the group name |
|
| 156 | */ |
|
| 157 | public function set_label( $label ) { |
|
| 158 | // Try to guess field label from it's name |
|
| 159 | if ( is_null( $label ) ) { |
|
| 160 | // remove the leading underscore(if it's there) |
|
| 161 | $label = preg_replace( '~^_~', '', $this->name ); |
|
| 162 | ||
| 163 | // remove the leading "crb_"(if it's there) |
|
| 164 | $label = preg_replace( '~^crb_~', '', $label ); |
|
| 165 | ||
| 166 | // split the name into words and make them capitalized |
|
| 167 | $label = ucwords( str_replace( '_', ' ', $label ) ); |
|
| 168 | } |
|
| 169 | ||
| 170 | $this->label = $label; |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * Label attribute getter. |
|
| @@ 606-620 (lines=15) @@ | ||
| 603 | * |
|
| 604 | * @param string $label If null, the label will be generated from the field name |
|
| 605 | **/ |
|
| 606 | public function set_label( $label ) { |
|
| 607 | // Try to guess field label from it's name |
|
| 608 | if ( is_null( $label ) ) { |
|
| 609 | // remove the leading underscore(if it's there) |
|
| 610 | $label = preg_replace( '~^_~', '', $this->name ); |
|
| 611 | ||
| 612 | // remove the leading "crb_"(if it's there) |
|
| 613 | $label = preg_replace( '~^crb_~', '', $label ); |
|
| 614 | ||
| 615 | // split the name into words and make them capitalized |
|
| 616 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
| 617 | } |
|
| 618 | ||
| 619 | $this->label = $label; |
|
| 620 | } |
|
| 621 | ||
| 622 | /** |
|
| 623 | * Return field label. |
|