@@ 161-175 (lines=15) @@ | ||
158 | * |
|
159 | * @param string $label If null, the label will be generated from the group name |
|
160 | */ |
|
161 | public function set_label( $label ) { |
|
162 | // Try to guess field label from it's name |
|
163 | if ( is_null( $label ) ) { |
|
164 | // remove the leading underscore(if it's there) |
|
165 | $label = preg_replace( '~^_~', '', $this->name ); |
|
166 | ||
167 | // remove the leading "crb_"(if it's there) |
|
168 | $label = preg_replace( '~^crb_~', '', $label ); |
|
169 | ||
170 | // split the name into words and make them capitalized |
|
171 | $label = ucwords( str_replace( '_', ' ', $label ) ); |
|
172 | } |
|
173 | ||
174 | $this->label = $label; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * Label attribute getter. |
@@ 473-487 (lines=15) @@ | ||
470 | * |
|
471 | * @param string $label If null, the label will be generated from the field name |
|
472 | **/ |
|
473 | public function set_label( $label ) { |
|
474 | // Try to guess field label from it's name |
|
475 | if ( is_null( $label ) ) { |
|
476 | // remove the leading underscore(if it's there) |
|
477 | $label = preg_replace( '~^_~', '', $this->name ); |
|
478 | ||
479 | // remove the leading "crb_"(if it's there) |
|
480 | $label = preg_replace( '~^crb_~', '', $label ); |
|
481 | ||
482 | // split the name into words and make them capitalized |
|
483 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
484 | } |
|
485 | ||
486 | $this->label = $label; |
|
487 | } |
|
488 | ||
489 | /** |
|
490 | * Return field label. |