*/ public static function all() { $templates = array( 'blank' => array( 'title' => __( 'Blank form', 'fillaro' ), 'description' => __( 'Start from an empty canvas.', 'fillaro' ), 'icon' => 'blank', 'fields' => array(), 'settings' => array(), 'theme' => array(), ), 'contact' => array( 'title' => __( 'Contact form', 'fillaro' ), 'description' => __( 'Name, email and message. The classic.', 'fillaro' ), 'icon' => 'mail', 'fields' => array( array( 'type' => 'name', 'key' => 'name', 'label' => __( 'Name', 'fillaro' ), 'required' => true, ), array( 'type' => 'email', 'key' => 'email', 'label' => __( 'Email', 'fillaro' ), 'required' => true, ), array( 'type' => 'text', 'key' => 'subject', 'label' => __( 'Subject', 'fillaro' ), ), array( 'type' => 'textarea', 'key' => 'message', 'label' => __( 'Message', 'fillaro' ), 'required' => true, 'rows' => 5, ), ), 'settings' => array( 'submitText' => __( 'Send message', 'fillaro' ), 'notifications' => array( 'admin' => array( 'replyTo' => 'email' ) ), ), 'theme' => array(), ), 'quote' => array( 'title' => __( 'Quote request', 'fillaro' ), 'description' => __( 'Collect project details and budget.', 'fillaro' ), 'icon' => 'briefcase', 'fields' => array( array( 'type' => 'name', 'key' => 'name', 'label' => __( 'Your name', 'fillaro' ), 'required' => true, 'format' => 'full', 'width' => 'half', ), array( 'type' => 'text', 'key' => 'company', 'label' => __( 'Company', 'fillaro' ), 'width' => 'half', ), array( 'type' => 'email', 'key' => 'email', 'label' => __( 'Work email', 'fillaro' ), 'required' => true, 'width' => 'half', ), array( 'type' => 'phone', 'key' => 'phone', 'label' => __( 'Phone', 'fillaro' ), 'width' => 'half', ), array( 'type' => 'checkboxes', 'key' => 'services', 'label' => __( 'What do you need?', 'fillaro' ), 'layout' => 'cards', 'required' => true, 'options' => self::options( array( __( 'Design', 'fillaro' ), __( 'Development', 'fillaro' ), __( 'Marketing', 'fillaro' ), __( 'Support', 'fillaro' ) ) ), ), array( 'type' => 'select', 'key' => 'budget', 'label' => __( 'Budget', 'fillaro' ), 'options' => self::options( array( '< $1,000', '$1,000 – $5,000', '$5,000 – $20,000', '$20,000+' ) ), ), array( 'type' => 'textarea', 'key' => 'details', 'label' => __( 'Project details', 'fillaro' ), 'required' => true, ), ), 'settings' => array( 'submitText' => __( 'Request a quote', 'fillaro' ), 'notifications' => array( 'admin' => array( 'replyTo' => 'email' ) ), ), 'theme' => array_merge( self::preset( 'sunset' ), array( 'preset' => 'sunset' ) ), ), 'feedback' => array( 'title' => __( 'Feedback survey', 'fillaro' ), 'description' => __( 'Ask customers how you are doing.', 'fillaro' ), 'icon' => 'smile', 'fields' => array( array( 'type' => 'radio', 'key' => 'satisfaction', 'label' => __( 'How happy are you with us?', 'fillaro' ), 'required' => true, 'layout' => 'inline', 'options' => self::options( array( __( 'Very happy', 'fillaro' ), __( 'Happy', 'fillaro' ), __( 'Neutral', 'fillaro' ), __( 'Unhappy', 'fillaro' ) ) ), ), array( 'type' => 'radio', 'key' => 'recommend', 'label' => __( 'Would you recommend us to a friend?', 'fillaro' ), 'layout' => 'inline', 'options' => self::options( array( __( 'Yes', 'fillaro' ), __( 'Maybe', 'fillaro' ), __( 'No', 'fillaro' ) ) ), ), array( 'type' => 'textarea', 'key' => 'improve', 'label' => __( 'What could we do better?', 'fillaro' ), ), array( 'type' => 'email', 'key' => 'email', 'label' => __( 'Email (if you want a reply)', 'fillaro' ), ), ), 'settings' => array( 'submitText' => __( 'Send feedback', 'fillaro' ) ), 'theme' => array_merge( self::preset( 'soft' ), array( 'preset' => 'soft' ) ), ), 'newsletter' => array( 'title' => __( 'Newsletter signup', 'fillaro' ), 'description' => __( 'A short, friendly subscribe box.', 'fillaro' ), 'icon' => 'send', 'fields' => array( array( 'type' => 'section', 'key' => 'intro', 'label' => __( 'Join the newsletter', 'fillaro' ), 'description' => __( 'One email a month. No spam, unsubscribe anytime.', 'fillaro' ), ), array( 'type' => 'email', 'key' => 'email', 'label' => __( 'Email', 'fillaro' ), 'hideLabel' => true, 'placeholder' => __( 'you@example.com', 'fillaro' ), 'required' => true, ), array( 'type' => 'consent', 'key' => 'consent', 'text' => __( 'I agree to receive emails.', 'fillaro' ), 'required' => true, ), ), 'settings' => array( 'submitText' => __( 'Subscribe', 'fillaro' ), 'confirmation' => array( 'message' => __( 'You are in! Check your inbox.', 'fillaro' ) ), ), 'theme' => array_merge( self::preset( 'midnight' ), array( 'preset' => 'midnight', 'maxWidth' => 480, ) ), ), 'registration' => array( 'title' => __( 'Event registration', 'fillaro' ), 'description' => __( 'Sign people up for a workshop or event.', 'fillaro' ), 'icon' => 'calendar', 'fields' => array( array( 'type' => 'name', 'key' => 'name', 'label' => __( 'Name', 'fillaro' ), 'required' => true, ), array( 'type' => 'email', 'key' => 'email', 'label' => __( 'Email', 'fillaro' ), 'required' => true, 'width' => 'half', ), array( 'type' => 'phone', 'key' => 'phone', 'label' => __( 'Phone', 'fillaro' ), 'width' => 'half', ), array( 'type' => 'radio', 'key' => 'session', 'label' => __( 'Which session?', 'fillaro' ), 'required' => true, 'layout' => 'cards', 'options' => self::options( array( __( 'Morning (9:00)', 'fillaro' ), __( 'Afternoon (14:00)', 'fillaro' ) ) ), ), array( 'type' => 'number', 'key' => 'guests', 'label' => __( 'Extra guests', 'fillaro' ), 'min' => 0, 'max' => 5, 'width' => 'third', ), array( 'type' => 'textarea', 'key' => 'notes', 'label' => __( 'Dietary needs or questions', 'fillaro' ), 'rows' => 3, ), ), 'settings' => array( 'submitText' => __( 'Register', 'fillaro' ), 'notifications' => array( 'user' => array( 'enabled' => true, 'emailField' => 'email', 'subject' => __( 'You are registered', 'fillaro' ), ), ), ), 'theme' => array_merge( self::preset( 'forest' ), array( 'preset' => 'forest' ) ), ), ); /** * Filters starter templates. * * @param array $templates Templates keyed by id. */ return apply_filters( 'fillaro/templates', $templates ); } /** * Theme tokens of a preset without its label. * * @param string $id Preset id. * @return array */ private static function preset( $id ) { $preset = Theme::presets()[ $id ]; unset( $preset['label'] ); return $preset; } /** * Option list from labels. * * @param string[] $labels Labels. * @return array */ private static function options( array $labels ) { return array_map( static function ( $label ) { return array( 'label' => $label, 'value' => $label, ); }, $labels ); } }