implode(',', array_keys(wu_get_plans_as_options())), 'pricing_table_template' => 'list', 'force_different_durations' => false, 'hide_pricing_table_when_pre_selected' => false, ]; } /** * 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 [ // 'name', ]; } /** * 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 [ 'id' => 'pricing_table', 'name' => __('Plan Selection', 'wp-multisite-waas'), 'required' => true, ]; } /** * Returns the list of available pricing table templates. * * @since 2.0.0 * @return array */ public function get_pricing_table_templates() { $available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('pricing_table'); return $available_templates; } /** * Returns the list of additional fields specific to this type. * * @since 2.0.0 * @return array */ public function get_fields() { $editor_fields = []; $editor_fields['pricing_table_products'] = [ 'type' => 'model', 'title' => __('Products', 'wp-multisite-waas'), 'placeholder' => __('e.g. Premium', 'wp-multisite-waas'), 'desc' => __('Be sure to add the products in the order you want them to show up.', 'wp-multisite-waas'), 'tooltip' => '', 'order' => 20, 'html_attr' => [ 'data-model' => 'product', 'data-value-field' => 'id', 'data-label-field' => 'name', 'data-search-field' => 'name', 'data-include' => implode(',', array_keys(wu_get_plans_as_options())), 'data-max-items' => 999, ], ]; $editor_fields['force_different_durations'] = [ 'type' => 'toggle', 'title' => __('Force Different Durations', 'wp-multisite-waas'), 'desc' => __('Check this option to force the display of plans with different recurring durations.', 'wp-multisite-waas'), 'tooltip' => '', 'value' => 0, 'order' => 22, 'html_attr' => [ 'v-model' => 'force_different_durations', ], ]; $editor_fields['hide_pricing_table_when_pre_selected'] = [ 'type' => 'toggle', 'title' => __('Hide when Pre-Selected', 'wp-multisite-waas'), 'desc' => __('Prevent customers from seeing this field when a plan was already selected via the URL.', 'wp-multisite-waas'), 'tooltip' => __('If the pricing table field is the only field in the current step, the step will be skipped.', 'wp-multisite-waas'), 'value' => 0, 'order' => 24, 'html_attr' => [ 'v-model' => 'hide_pricing_table_when_pre_selected', ], ]; $editor_fields['pricing_table_template'] = [ 'type' => 'group', 'desc' => Field_Templates_Manager::get_instance()->render_preview_block('pricing_table'), 'order' => 26, 'fields' => [ 'pricing_table_template' => [ 'type' => 'select', 'title' => __('Pricing Table Template', 'wp-multisite-waas'), 'placeholder' => __('Select your Template', 'wp-multisite-waas'), 'options' => [$this, 'get_pricing_table_templates'], 'wrapper_classes' => 'wu-flex-grow', 'html_attr' => [ 'v-model' => 'pricing_table_template', ], ], ], ]; // @todo: re-add developer notes. // $editor_fields['_dev_note_develop_your_own_template_2'] = array( // 'type' => 'note', // 'order' => 99, // 'wrapper_classes' => 'sm:wu-p-0 sm:wu-block', // 'classes' => '', // 'desc' => sprintf('