* @link https://TheTempusProject.com/Core * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Houdini\Classes; use TheTempusProject\Canary\Bin\Canary as Debug; use DateTimeZone; class Forms { public static $options = []; /** * Sets the specified radio button with $x value to checked. * * @param {string} [$fieldName] - The name of the radio field. * @param {string} [$value] - The field value to be selected. */ public static function selectRadio( $fieldName, $value ) { $selected = 'CHECKED:' . $fieldName . '=' . $value; Components::set( $selected, 'checked="checked"' ); } /** * This will add an option to our selected options menu that will * automatically be selected when the template is rendered. * * @param {string} [$value] - The value of the option you want selected. */ public static function selectOption( $value ) { $find = "#\'; } return $out; } public static function getRadioHtml( $name, $options, $default = null ) { if ( null === $default ) { $option_one = ''; $option_two = ''; } elseif ( $options[0] == $default ) { $option_one = ' checked="checked"'; $option_two = ''; } elseif ( $options[1] == $default ) { $option_one = ''; $option_two = ' checked="checked"'; } else { $option_one = ''; $option_two = ''; } $out = '
'; return $out; } public static function getSwitchHtml( $name, $default = null ) { $checked = ''; if ( ! empty( $default ) ) { $checked = ' checked="checked"'; } $out = '
'; return $out; } }