implode(',', wu_get_site_templates(['fields' => 'ids'])), 'template_selection_type' => 'name', 'template_selection_template' => 'clean', 'cols' => 3, 'hide_template_selection_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' => 'template_selection', 'name' => __('Template Selection', 'wp-multisite-waas'), 'required' => true, ]; } /** * Returns the list of available pricing table templates. * * @since 2.0.0 * @return array */ public function get_template_selection_templates() { $available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('template_selection'); 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['cols'] = [ 'type' => 'hidden', ]; $editor_fields['template_selection_type'] = [ 'type' => 'select', 'title' => __('Available templates', 'wp-multisite-waas'), 'desc' => __('How do you want to choose available which templates will be available.', 'wp-multisite-waas'), 'order' => 20, 'options' => [ 'name' => __('Select by names'), 'categories' => __('Select by categories'), 'all' => __('All templates'), ], 'html_attr' => [ 'v-model' => 'template_selection_type', ], ]; $editor_fields['template_selection_categories'] = [ 'type' => 'select', 'title' => __('Template Categories', 'wp-multisite-waas'), 'placeholder' => __('e.g.: Landing Page, Health...', 'wp-multisite-waas'), 'desc' => __('Customers will be able to filter by categories during signup.', 'wp-multisite-waas'), 'order' => 21, 'options' => Site::get_all_categories(), 'html_attr' => [ 'data-selectize-categories' => 1, 'multiple' => 1, ], 'wrapper_html_attr' => [ 'v-show' => 'template_selection_type === "categories"', ], ]; $editor_fields['template_selection_sites'] = [ 'type' => 'model', 'title' => __('Template Sites', 'wp-multisite-waas'), 'placeholder' => __('e.g. Template Site 1, My Agency', 'wp-multisite-waas'), 'desc' => __('Be sure to add the templates in the order you want them to show up.', 'wp-multisite-waas'), 'order' => 22, 'html_attr' => [ 'v-model' => 'template_selection_sites', 'data-model' => 'site', 'data-value-field' => 'blog_id', 'data-label-field' => 'title', 'data-search-field' => 'title', 'data-max-items' => 999, 'data-include' => implode( ',', wu_get_site_templates( [ 'fields' => 'blog_id', ] ) ), ], 'wrapper_html_attr' => [ 'v-show' => 'template_selection_type === \'name\'', ], ]; $editor_fields['hide_template_selection_when_pre_selected'] = [ 'type' => 'toggle', 'title' => __('Hide when Pre-Selected', 'wp-multisite-waas'), 'desc' => __('Prevent customers from seeing this field when a template was already selected via the URL.', 'wp-multisite-waas'), 'tooltip' => __('If the template selection field is the only field in the current step, the step will be skipped.', 'wp-multisite-waas'), 'value' => 0, 'order' => 23, 'html_attr' => [ 'v-model' => 'hide_template_selection_when_pre_selected', ], ]; $editor_fields['template_selection_template'] = [ 'type' => 'group', 'order' => 24, 'desc' => Field_Templates_Manager::get_instance()->render_preview_block('template_selection'), 'fields' => [ 'template_selection_template' => [ 'type' => 'select', 'title' => __('Template Selector Template', 'wp-multisite-waas'), 'placeholder' => __('Select your Template', 'wp-multisite-waas'), 'options' => [$this, 'get_template_selection_templates'], 'wrapper_classes' => 'wu-flex-grow', 'html_attr' => [ 'v-model' => 'template_selection_template', ], ], ], ]; // @todo: re-add developer notes. // $editor_fields['_dev_note_develop_your_own_template_1'] = array( // 'type' => 'note', // 'order' => 99, // 'wrapper_classes' => 'sm:wu-p-0 sm:wu-block', // 'classes' => '', // 'desc' => sprintf('