name = 'text'; $this->label = __( 'Text', 'cfs' ); } /** * Generate the field HTML * @param object $field * @since 1.0.5 */ function html( $field ) { ?> create_field( array( 'type' => 'true_false', 'input_name' => "cfs[fields][$key][options][required]", 'input_class' => 'true_false', 'value' => $this->get_option( $field, 'required' ), 'options' => array( 'message' => __( 'This is a required field', 'cfs' ) ), )); ?> get * @param mixed $value * @param mixed $field The field object (optional) * @return mixed * @since 1.0.5 */ function format_value_for_api( $value, $field = null ) { return $value; } /** * Format the value for use with HTML input elements * @param mixed $value * @param mixed $field The field object (optional) * @return mixed * @since 1.0.5 */ function format_value_for_input( $value, $field = null ) { return $value; } /** * Format the value before saving to DB * @param mixed $value * @param mixed $field The field object (optional) * @return mixed * @since 1.4.2 */ function pre_save( $value, $field = null ) { return $value; } /** * Modify field settings before saving to DB * @param object $field * @return object * @since 1.6.8 */ function pre_save_field( $field ) { return $field; } /** * Helper method to retrieve a field setting * @param object $field * @param string $option_name * @param mixed $default_value * @return mixed * @since 1.4.3 */ function get_option( $field, $option_name, $default_value = '' ) { if ( isset( $field->options[ $option_name ] ) ) { if ( is_string( $field->options[ $option_name ] ) ) { return esc_attr( $field->options[ $option_name ] ); } return $field->options[ $option_name ]; } return $default_value; } }