true, ); } /** * List of keys of the default fields we want to display on the builder. * * @since 2.0.0 * @return array */ public function default_fields() { return array( 'id', 'save_as', ); } /** * If you want to force a particular attribute to a value, declare it here. * * @since 2.0.0 * @return array */ public function force_attributes() { return array(); } /** * Returns the list of additional fields specific to this type. * * @since 2.0.0 * @return array */ public function get_fields() { return array( 'fixed_value' => array( 'order' => 12, 'type' => 'text', 'title' => __('Pre-filled Value', 'wp-ultimo'), 'desc' => __('The field will be populated with this value. Can be overridden if the pre-fill from request option is enabled.', 'wp-ultimo'), 'placeholder' => __('e.g. blue', 'wp-ultimo'), 'tooltip' => '', 'value' => '', ), ); } /** * Gets the pre-filled value for the field. * * @since 2.0.0 * @return mixed */ public function get_value() { $value = parent::get_value(); if (empty($value)) { $value = $this->attributes['fixed_value']; } return $value; } /** * Returns the field/element actual field array to be used on the checkout form. * * @since 2.0.0 * * @param array $attributes Attributes saved on the editor form. * @return array An array of fields, not the field itself. */ public function to_fields_array($attributes) { return array( $attributes['id'] => array( 'type' => 'hidden', 'id' => $attributes['id'], 'wrapper_classes' => $attributes['element_classes'], 'value' => $this->get_value(), ), ); } }