| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FirePlugins Framework |
| 4 |
* @version 1.1.146 |
| 5 |
* |
| 6 |
* @author FirePlugins <[email protected]> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace FPFramework\Base\Fields; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) |
| 15 |
{ |
| 16 |
exit; // Exit if accessed directly. |
| 17 |
} |
| 18 |
|
| 19 |
use FPFramework\Base\Field; |
| 20 |
use FPFramework\Libs\Registry; |
| 21 |
|
| 22 |
class Radio extends Field |
| 23 |
{ |
| 24 |
/** |
| 25 |
* Set specific field options |
| 26 |
* |
| 27 |
* @param array $options |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
protected function setFieldOptions($options) |
| 32 |
{ |
| 33 |
$options = new Registry($options); |
| 34 |
|
| 35 |
$this->field_options = [ |
| 36 |
'cols' => $options->get('cols'), |
| 37 |
'choices' => $options->get('choices', []) |
| 38 |
]; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Runs before field renders |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
public function onBeforeRender() |
| 47 |
{ |
| 48 |
// CSS |
| 49 |
wp_register_style( |
| 50 |
'fpframework-choice-field', |
| 51 |
FPF_MEDIA_URL . 'admin/css/fpf_choice.css', |
| 52 |
[], |
| 53 |
FPF_VERSION, |
| 54 |
false |
| 55 |
); |
| 56 |
wp_enqueue_style( 'fpframework-choice-field' ); |
| 57 |
} |
| 58 |
} |