false, ); } // end defaults; /** * 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( 'name', 'placeholder', 'tooltip', ); } // end default_fields; /** * 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( 'id' => 'site_title', 'required' => true, ); } // end force_attributes; /** * Returns the list of additional fields specific to this type. * * @since 2.0.0 * @return array */ public function get_fields() { return array( 'auto_generate_site_title' => array( 'type' => 'toggle', 'title' => __('Auto-generate?', 'wp-ultimo'), 'desc' => __('Check this option to auto-generate this field based on the username of the customer.', 'wp-ultimo'), 'tooltip' => '', 'value' => 0, 'html_attr' => array( 'v-model' => 'auto_generate_site_title', ), ), ); } // end get_fields; /** * 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) { /* * If we should auto-generate, add as hidden. */ if (isset($attributes['auto_generate_site_title']) && $attributes['auto_generate_site_title']) { return array( 'auto_generate_site_title' => array( 'type' => 'hidden', 'id' => 'auto_generate_site_title', 'value' => 'username', ), 'site_title' => array( 'type' => 'hidden', 'id' => 'site_title', 'html_attr' => array( 'v-bind:value' => 'username', ) ), ); } // end if; return array( 'site_title' => array( 'type' => 'text', 'id' => 'site_title', 'required' => true, 'name' => $attributes['name'], 'placeholder' => $attributes['placeholder'], 'tooltip' => $attributes['tooltip'], 'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''), 'classes' => wu_get_isset($attributes, 'element_classes', ''), 'value' => $this->get_value(), 'wrapper_html_attr' => array( 'style' => $this->calculate_style_attr(), ), ), ); } // end to_fields_array; } // end class Signup_Field_Site_Title;