Returns the available settings fields.
Description
See also
Return
(array) Associative array of <code>$field_slug => $field_args</code> pairs.
Source
File: src/db-objects/forms/form-settings-page.php
protected function get_fields() { $options = $this->form_manager->options()->get( 'general_settings', array() ); $modules = array(); foreach ( torro()->modules()->get_all() as $slug => $module ) { $modules[ $slug ] = $module->get_title(); } $default_modules = array_keys( $modules ); $default_slug = _x( 'forms', 'default form rewrite slug', 'torro-forms' ); $fields = array( 'modules' => array( 'section' => 'modules', 'type' => 'multibox', 'label' => __( 'Active Modules', 'torro-forms' ), 'description' => __( 'If you do not need all of these modules, you can disable them here.', 'torro-forms' ), 'choices' => $modules, 'default' => $default_modules, ), 'slug' => array( 'section' => 'form_behavior', 'type' => 'text', 'label' => __( 'Slug', 'torro-forms' ), 'description' => sprintf( __( 'The slug for permalinks (e.g. for a URL like %s).', 'torro-forms' ), home_url( '/' ) . '<strong id="torro-rewrite-slug-preview">' . ( ! empty( $options['slug'] ) ? $options['slug'] : $default_slug ) . '</strong>/my-contact-form/' ), 'default' => $default_slug, 'required' => true, ), ); $attachment_taxonomy_slug = torro()->taxonomies()->get_attachment_taxonomy_slug(); if ( ! empty( $attachment_taxonomy_slug ) ) { $attachment_taxonomy = get_taxonomy( $attachment_taxonomy_slug ); if ( $attachment_taxonomy ) { $term_choices = array( '0' => _x( 'None', 'term choices', 'torro-forms' ) ); $terms = get_terms( array( 'taxonomy' => $attachment_taxonomy->name, 'number' => 0, 'hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC', ) ); if ( ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $term_choices[ $term->term_id ] = $term->name; } } $fields['attachment_taxonomy_term_id'] = array( 'section' => 'form_behavior', 'type' => 'select', /* translators: %s: attachment taxonomy name */ 'label' => sprintf( __( '%s Term', 'torro-forms' ), $attachment_taxonomy->labels->singular_name ), 'description' => __( 'The default term to use for form uploads.', 'torro-forms' ), 'default' => '0', 'choices' => $term_choices, ); } } $fields = array_merge( $fields, array( 'frontend_css' => array( 'section' => 'advanced', 'type' => 'checkbox', 'label' => __( 'Include Torro Forms CSS on frontend?', 'torro-forms' ), 'default' => true, ), 'delete_submissions' => array( 'section' => 'advanced', 'type' => 'checkbox', 'label' => __( 'Delete submission that have not completed after a certain amount of time?', 'torro-forms' ), 'description' => __( 'Enabling this setting can help keep your database cleaner by deleting submissions that have been started, but never completed.', 'torro-forms' ), 'default' => false, ), 'delete_submissions_days' => array( 'section' => 'advanced', 'type' => 'number', 'label' => __( 'Submission Deletion', 'torro-forms' ), 'description' => __( 'Specify the number of days after which incomplete submissions should be deleted.', 'torro-forms' ), 'min' => 1, 'step' => 1, 'default' => 1, 'unit' => _x( 'day/s', 'field unit', 'torro-forms' ), 'input_classes' => array( 'small-text' ), 'dependencies' => array( array( 'prop' => 'display', 'callback' => 'get_data_by_condition_true', 'fields' => array( 'delete_submissions' ), 'args' => array(), ), ), ), 'hard_uninstall' => array( 'section' => 'advanced', 'type' => 'checkbox', 'label' => __( 'Perform a hard uninstall when the plugin is removed?', 'torro-forms' ), 'description' => __( '<strong>Use this setting with extreme caution</strong> as, when it is enabled, removing the plugin will remove all form content from your site forever.', 'torro-forms' ), 'default' => false, ), ) ); /** * Filters the form settings fields. * * @since 1.0.0 * * @param array $tabs Associative array of `$field_slug => $field_args` pairs. */ return apply_filters( "{$this->manager->get_prefix()}settings_fields", $fields ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |