| @@ 7-26 (lines=20) @@ | ||
| 4 | ||
| 5 | use GeminiLabs\Castor\Forms\Fields\Base; |
|
| 6 | ||
| 7 | class Select extends Base |
|
| 8 | { |
|
| 9 | protected $element = 'select'; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @return string |
|
| 13 | */ |
|
| 14 | public function render( array $defaults = [] ) |
|
| 15 | { |
|
| 16 | $defaults = wp_parse_args( $defaults, [ |
|
| 17 | 'type' => 'select', |
|
| 18 | ]); |
|
| 19 | ||
| 20 | return sprintf( '<select %s>%s</select>%s', |
|
| 21 | $this->implodeAttributes( $defaults ), |
|
| 22 | $this->implodeOptions( 'select_option' ), |
|
| 23 | $this->generateDescription() |
|
| 24 | ); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 7-26 (lines=20) @@ | ||
| 4 | ||
| 5 | use GeminiLabs\Castor\Forms\Fields\Base; |
|
| 6 | ||
| 7 | class Text extends Base |
|
| 8 | { |
|
| 9 | protected $element = 'input'; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @return string |
|
| 13 | */ |
|
| 14 | public function render( array $defaults = [] ) |
|
| 15 | { |
|
| 16 | $defaults = wp_parse_args( $defaults, [ |
|
| 17 | 'class' => 'regular-text', |
|
| 18 | 'type' => 'text', |
|
| 19 | ]); |
|
| 20 | ||
| 21 | return sprintf( '<input %s/>%s', |
|
| 22 | $this->implodeAttributes( $defaults ), |
|
| 23 | $this->generateDescription() |
|
| 24 | ); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||