__( 'Start here', '2ranq-forms' ), 'contact' => __( 'Contact', '2ranq-forms' ), 'booking' => __( 'Bookings and appointments', '2ranq-forms' ), 'quote' => __( 'Quotes and orders', '2ranq-forms' ), 'application' => __( 'Applications, step by step', '2ranq-forms' ), 'verification' => __( 'Verification and documents', '2ranq-forms' ), 'support' => __( 'Support', '2ranq-forms' ), 'signup' => __( 'Sign ups and events', '2ranq-forms' ), 'feedback' => __( 'Feedback and surveys', '2ranq-forms' ), ); } /** * Every template. * * @return array */ public static function all() { $templates = array( /* ------------------------------------------------ start */ 'blank' => array( 'name' => __( 'Blank form', '2ranq-forms' ), 'description' => __( 'Start with nothing and build your own.', '2ranq-forms' ), 'group' => 'start', 'fields' => array(), ), /* ------------------------------------------------ contact */ 'contact' => array( 'name' => __( 'Simple contact', '2ranq-forms' ), 'description' => __( 'Name, email and a message. The one most sites need.', '2ranq-forms' ), 'group' => 'contact', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true ), self::field( 'message', 'textarea', __( 'Message', '2ranq-forms' ), true, array( 'rows' => 6 ) ), ), ), 'contact-detailed' => array( 'name' => __( 'Detailed contact', '2ranq-forms' ), 'description' => __( 'Adds a phone number, a subject and how they found you.', '2ranq-forms' ), 'group' => 'contact', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'subject', 'select', __( 'What is it about', '2ranq-forms' ), true, array( __( 'General question', '2ranq-forms' ), __( 'Existing order', '2ranq-forms' ), __( 'Working together', '2ranq-forms' ), __( 'Something else', '2ranq-forms' ), ), array( 'size' => 'half' ) ), self::field( 'message', 'textarea', __( 'Message', '2ranq-forms' ), true, array( 'rows' => 6 ) ), self::choice_field( 'found', 'select', __( 'How did you find us', '2ranq-forms' ), false, array( __( 'Search engine', '2ranq-forms' ), __( 'A friend', '2ranq-forms' ), __( 'Social media', '2ranq-forms' ), __( 'I am already a customer', '2ranq-forms' ), ) ), self::consent( 'consent' ), ), ), 'callback' => array( 'name' => __( 'Request a call back', '2ranq-forms' ), 'description' => __( 'Three fields. For visitors who would rather talk.', '2ranq-forms' ), 'group' => 'contact', 'fields' => array( self::field( 'name', 'text', __( 'Your name', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone number', '2ranq-forms' ), true ), self::choice_field( 'when', 'radio', __( 'Best time to call', '2ranq-forms' ), true, array( __( 'Morning', '2ranq-forms' ), __( 'Afternoon', '2ranq-forms' ), __( 'Evening', '2ranq-forms' ), ) ), ), ), /* ------------------------------------------------ appointments */ 'appointment' => array( 'name' => __( 'Book an appointment', '2ranq-forms' ), 'description' => __( 'Date, time and what it is for. For clinics, salons and studios.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'date', 'date', __( 'Preferred day', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'time', 'time', __( 'Preferred time', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'service', 'select', __( 'What do you need', '2ranq-forms' ), true, array( __( 'First visit', '2ranq-forms' ), __( 'Follow up', '2ranq-forms' ), __( 'Consultation', '2ranq-forms' ), ) ), self::field( 'notes', 'textarea', __( 'Anything we should know', '2ranq-forms' ), false, array( 'rows' => 4 ) ), ), ), 'restaurant-booking' => array( 'name' => __( 'Reserve a table', '2ranq-forms' ), 'description' => __( 'Party size, date and time. For restaurants and cafes.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'text', __( 'Name for the booking', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'people', 'number', __( 'How many people', '2ranq-forms' ), true, array( 'size' => 'half', 'min' => 1, 'max' => 30 ) ), self::field( 'date', 'date', __( 'Date', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'time', 'time', __( 'Time', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'notes', 'textarea', __( 'Allergies or requests', '2ranq-forms' ), false, array( 'rows' => 3 ) ), ), ), 'viewing' => array( 'name' => __( 'Book a viewing', '2ranq-forms' ), 'description' => __( 'For estate agents. Which property and when.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'property', 'text', __( 'Property reference', '2ranq-forms' ), false ), self::field( 'date', 'date', __( 'Preferred day', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::choice_field( 'slot', 'select', __( 'Preferred time', '2ranq-forms' ), false, array( __( 'Morning', '2ranq-forms' ), __( 'Afternoon', '2ranq-forms' ), __( 'Evening', '2ranq-forms' ), ), array( 'size' => 'half' ) ), ), ), 'transfer-booking' => array( 'name' => __( 'Book a transfer', '2ranq-forms' ), 'description' => __( 'Who is travelling, which vehicle, when and where. For airport transfers and private drivers.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'first_name', 'text', __( 'First Name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'last_name', 'text', __( 'Last Name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email Address', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone Number', '2ranq-forms' ), true ), array( 'id' => 'vehicle', 'type' => 'imagechoice', 'label' => __( 'Select Vehicle', '2ranq-forms' ), 'required' => true, 'picture_layout' => 'list', 'picture_meta_label' => __( 'Vehicle', '2ranq-forms' ), 'choices' => array( self::picture( __( 'Executive Sedan', '2ranq-forms' ), 'executive-sedan', 'car-sedan-executive.webp', __( '4 seats, sedan', '2ranq-forms' ), true ), self::picture( __( 'Black Sedan', '2ranq-forms' ), 'black-sedan', 'car-sedan-black.webp', __( '4 seats, sedan', '2ranq-forms' ) ), self::picture( __( 'Grey Sedan', '2ranq-forms' ), 'grey-sedan', 'car-sedan-grey.webp', __( '4 seats, sedan', '2ranq-forms' ) ), self::picture( __( 'Passenger Van', '2ranq-forms' ), 'passenger-van', 'car-van.webp', __( '7 seats, van', '2ranq-forms' ) ), ), ), self::field( 'date', 'date', __( 'Date', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'time', 'time', __( 'Time', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'pickup', 'text', __( 'Pick-up Location', '2ranq-forms' ), true, array( 'placeholder' => __( 'Enter pick-up address', '2ranq-forms' ) ) ), self::field( 'dropoff', 'text', __( 'Drop-off Location', '2ranq-forms' ), false, array( 'placeholder' => __( 'Enter drop-off address', '2ranq-forms' ) ) ), self::field( 'requests', 'textarea', __( 'Special Requests', '2ranq-forms' ), false, array( 'rows' => 3, 'placeholder' => __( 'Enter any special requests or notes', '2ranq-forms' ) ) ), ), ), 'table-booking' => array( 'name' => __( 'Book a table', '2ranq-forms' ), 'description' => __( 'Night, group size and which room. For clubs, bars and restaurants.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'text', __( 'Full Name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'birth', 'date', __( 'Date of birth', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Telephone number', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::choice_field( 'people', 'select', __( 'Number of people', '2ranq-forms' ), true, array( '1 to 3', '3 to 5', '6 to 8', '9 to 12', '12 to 15', '15 to 20', '20 or more', ), array( 'size' => 'half' ) ), self::choice_field( 'venue', 'select', __( 'Which room', '2ranq-forms' ), true, array( __( 'Main room', '2ranq-forms' ), __( 'Terrace', '2ranq-forms' ), __( 'Lounge', '2ranq-forms' ), __( 'Private room', '2ranq-forms' ), ), array( 'size' => 'half' ) ), self::field( 'date', 'date', __( 'Reservation Date', '2ranq-forms' ), true ), self::field( 'request', 'textarea', __( 'Special request', '2ranq-forms' ), false, array( 'rows' => 4 ) ), ), ), 'product-enquiry' => array( 'name' => __( 'Ask about a product', '2ranq-forms' ), 'description' => __( 'Name, email, which product, and the question. For shops.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'text', __( 'Name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'product', 'text', __( 'Product name or code', '2ranq-forms' ), false ), self::field( 'size_note', 'text', __( 'Size or model, if you know it', '2ranq-forms' ), false ), self::field( 'question', 'textarea', __( 'Your question', '2ranq-forms' ), true, array( 'rows' => 4 ) ), ), ), 'car-service' => array( 'name' => __( 'Book a car service', '2ranq-forms' ), 'description' => __( 'Vehicle details and the problem. For garages.', '2ranq-forms' ), 'group' => 'booking', 'fields' => array( self::field( 'name', 'text', __( 'Your name', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'plate', 'text', __( 'Licence plate', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'make', 'text', __( 'Make and model', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'mileage', 'number', __( 'Mileage', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'work', 'checkbox', __( 'What needs doing', '2ranq-forms' ), true, array( __( 'Routine service', '2ranq-forms' ), __( 'Brakes', '2ranq-forms' ), __( 'Tyres', '2ranq-forms' ), __( 'Something is making a noise', '2ranq-forms' ), __( 'I do not know', '2ranq-forms' ), ) ), self::field( 'date', 'date', __( 'When can you bring it in', '2ranq-forms' ), false ), ), ), /* ------------------------------------------------ prices and orders */ 'quote' => array( 'name' => __( 'Request a quote', '2ranq-forms' ), 'description' => __( 'What the job is and what the budget is.', '2ranq-forms' ), 'group' => 'quote', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'service', 'select', __( 'What do you need', '2ranq-forms' ), true, array( __( 'A new project', '2ranq-forms' ), __( 'Changes to something existing', '2ranq-forms' ), __( 'Ongoing work', '2ranq-forms' ), __( 'Something else', '2ranq-forms' ), ) ), self::choice_field( 'budget', 'radio', __( 'Rough budget', '2ranq-forms' ), false, array( __( 'Under 1,000', '2ranq-forms' ), __( '1,000 to 5,000', '2ranq-forms' ), __( '5,000 to 20,000', '2ranq-forms' ), __( 'Over 20,000', '2ranq-forms' ), ) ), self::field( 'details', 'textarea', __( 'Tell us about the job', '2ranq-forms' ), true, array( 'rows' => 6 ) ), self::file( 'plans', __( 'Plans or photos', '2ranq-forms' ), false, 3 ), ), ), 'building-quote' => array( 'name' => __( 'Building work quote', '2ranq-forms' ), 'description' => __( 'Property, scope and photos. For builders and trades.', '2ranq-forms' ), 'group' => 'quote', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'address', 'address', __( 'Where is the property', '2ranq-forms' ), true ), self::choice_field( 'work', 'checkbox', __( 'What kind of work', '2ranq-forms' ), true, array( __( 'Kitchen', '2ranq-forms' ), __( 'Bathroom', '2ranq-forms' ), __( 'Extension', '2ranq-forms' ), __( 'Roofing', '2ranq-forms' ), __( 'Whole property', '2ranq-forms' ), ) ), self::field( 'start', 'date', __( 'When would you like to start', '2ranq-forms' ), false ), self::field( 'details', 'textarea', __( 'Describe the job', '2ranq-forms' ), true, array( 'rows' => 5 ) ), self::file( 'photos', __( 'Photos of the space', '2ranq-forms' ), false, 5 ), ), ), 'catering-order' => array( 'name' => __( 'Catering order', '2ranq-forms' ), 'description' => __( 'Head count, date and allergies.', '2ranq-forms' ), 'group' => 'quote', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'date', 'date', __( 'Date of the event', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'guests', 'number', __( 'Number of guests', '2ranq-forms' ), true, array( 'size' => 'half', 'min' => 1 ) ), self::choice_field( 'style', 'radio', __( 'Style of service', '2ranq-forms' ), true, array( __( 'Buffet', '2ranq-forms' ), __( 'Plated', '2ranq-forms' ), __( 'Canapes', '2ranq-forms' ), ) ), self::field( 'allergies', 'textarea', __( 'Allergies and dietary needs', '2ranq-forms' ), false, array( 'rows' => 4 ) ), ), ), 'return-request' => array( 'name' => __( 'Return or exchange', '2ranq-forms' ), 'description' => __( 'Order number, reason and a photo. For shops.', '2ranq-forms' ), 'group' => 'quote', 'fields' => array( self::field( 'order', 'text', __( 'Order number', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email on the order', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::choice_field( 'what', 'radio', __( 'What would you like', '2ranq-forms' ), true, array( __( 'A refund', '2ranq-forms' ), __( 'An exchange', '2ranq-forms' ), __( 'A repair', '2ranq-forms' ), ) ), self::choice_field( 'reason', 'select', __( 'Reason', '2ranq-forms' ), true, array( __( 'Wrong size', '2ranq-forms' ), __( 'Arrived damaged', '2ranq-forms' ), __( 'Not as described', '2ranq-forms' ), __( 'Changed my mind', '2ranq-forms' ), ) ), self::field( 'details', 'textarea', __( 'Tell us what happened', '2ranq-forms' ), false, array( 'rows' => 4 ) ), self::file( 'photo', __( 'Photo of the item', '2ranq-forms' ), false, 3 ), ), ), /* ------------------------------------------------ applications, in steps */ 'job-application' => array( 'name' => __( 'Job application', '2ranq-forms' ), 'description' => __( 'Three steps: who you are, your experience, your resume.', '2ranq-forms' ), 'group' => 'application', 'fields' => array( self::heading( 'h1', __( 'About you', '2ranq-forms' ), __( 'Takes about four minutes. Nothing is sent until the last step.', '2ranq-forms' ) ), self::field( 'name', 'name', __( 'Full name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'address', 'address', __( 'Where do you live', '2ranq-forms' ), false ), self::step( 'step1', __( 'About you', '2ranq-forms' ), __( 'Continue to experience', '2ranq-forms' ) ), self::heading( 'h2', __( 'Your experience', '2ranq-forms' ), '' ), self::field( 'role', 'text', __( 'Role you are applying for', '2ranq-forms' ), true ), self::choice_field( 'years', 'select', __( 'Years of experience', '2ranq-forms' ), true, array( __( 'Less than one', '2ranq-forms' ), __( 'One to three', '2ranq-forms' ), __( 'Three to seven', '2ranq-forms' ), __( 'More than seven', '2ranq-forms' ), ), array( 'size' => 'half' ) ), self::field( 'notice', 'text', __( 'Notice period', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::field( 'why', 'textarea', __( 'Why this role', '2ranq-forms' ), true, array( 'rows' => 5 ) ), self::field( 'portfolio', 'url', __( 'Portfolio or LinkedIn', '2ranq-forms' ), false ), self::step( 'step2', __( 'Your experience', '2ranq-forms' ), __( 'Continue to documents', '2ranq-forms' ) ), self::heading( 'h3', __( 'Documents', '2ranq-forms' ), __( 'PDF or Word, up to 8 megabytes each.', '2ranq-forms' ) ), self::file( 'resume', __( 'Resume', '2ranq-forms' ), true, 1, 'pdf,doc,docx' ), self::file( 'cover', __( 'Cover letter', '2ranq-forms' ), false, 1, 'pdf,doc,docx' ), self::consent( 'consent', __( 'I agree that my details are kept for this application', '2ranq-forms' ) ), ), ), 'membership' => array( 'name' => __( 'Membership application', '2ranq-forms' ), 'description' => __( 'Two steps: your details, then your plan.', '2ranq-forms' ), 'group' => 'application', 'fields' => array( self::heading( 'h1', __( 'Your details', '2ranq-forms' ), '' ), self::field( 'name', 'name', __( 'Full name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'birth', 'date', __( 'Date of birth', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::step( 'step1', __( 'Your details', '2ranq-forms' ), __( 'Choose a plan', '2ranq-forms' ) ), self::heading( 'h2', __( 'Your plan', '2ranq-forms' ), '' ), self::choice_field( 'plan', 'radio', __( 'Which plan', '2ranq-forms' ), true, array( __( 'Monthly, no contract', '2ranq-forms' ), __( 'Twelve months, better price', '2ranq-forms' ), __( 'Day pass', '2ranq-forms' ), ) ), self::field( 'start', 'date', __( 'Start date', '2ranq-forms' ), true ), self::field( 'notes', 'textarea', __( 'Anything we should know', '2ranq-forms' ), false, array( 'rows' => 4 ) ), self::consent( 'terms', __( 'I have read the terms and conditions', '2ranq-forms' ) ), ), ), 'course-enrolment' => array( 'name' => __( 'Course enrolment', '2ranq-forms' ), 'description' => __( 'Student details, course choice and previous study.', '2ranq-forms' ), 'group' => 'application', 'fields' => array( self::heading( 'h1', __( 'Student details', '2ranq-forms' ), '' ), self::field( 'name', 'name', __( 'Full name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'birth', 'date', __( 'Date of birth', '2ranq-forms' ), true ), self::step( 'step1', __( 'Student details', '2ranq-forms' ), __( 'Choose your course', '2ranq-forms' ) ), self::heading( 'h2', __( 'Your course', '2ranq-forms' ), '' ), self::choice_field( 'course', 'select', __( 'Which course', '2ranq-forms' ), true, array( __( 'Foundation', '2ranq-forms' ), __( 'Intermediate', '2ranq-forms' ), __( 'Advanced', '2ranq-forms' ), ) ), self::choice_field( 'mode', 'radio', __( 'How would you like to study', '2ranq-forms' ), true, array( __( 'In person', '2ranq-forms' ), __( 'Online', '2ranq-forms' ), __( 'A mix of both', '2ranq-forms' ), ) ), self::field( 'previous', 'textarea', __( 'Previous study or work', '2ranq-forms' ), false, array( 'rows' => 4 ) ), self::step( 'step2', __( 'Your course', '2ranq-forms' ), __( 'Attach your documents', '2ranq-forms' ) ), self::heading( 'h3', __( 'Documents', '2ranq-forms' ), __( 'Certificates or transcripts, if you have them.', '2ranq-forms' ) ), self::file( 'certs', __( 'Certificates', '2ranq-forms' ), false, 4, 'pdf,jpg,jpeg,png' ), self::consent( 'consent' ), ), ), 'vendor-onboarding' => array( 'name' => __( 'Vendor onboarding', '2ranq-forms' ), 'description' => __( 'Company, contact and paperwork. Three steps.', '2ranq-forms' ), 'group' => 'application', 'fields' => array( self::heading( 'h1', __( 'Company', '2ranq-forms' ), '' ), self::field( 'company', 'text', __( 'Company name', '2ranq-forms' ), true ), self::field( 'tax', 'text', __( 'Tax or registration number', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'site', 'url', __( 'Website', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::field( 'address', 'address', __( 'Registered address', '2ranq-forms' ), true ), self::step( 'step1', __( 'Company', '2ranq-forms' ), __( 'Continue to contact', '2ranq-forms' ) ), self::heading( 'h2', __( 'Who do we talk to', '2ranq-forms' ), '' ), self::field( 'name', 'name', __( 'Contact name', '2ranq-forms' ), true ), self::field( 'role', 'text', __( 'Role', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::step( 'step2', __( 'Contact', '2ranq-forms' ), __( 'Continue to documents', '2ranq-forms' ) ), self::heading( 'h3', __( 'Paperwork', '2ranq-forms' ), '' ), self::file( 'registration', __( 'Company registration', '2ranq-forms' ), true, 1, 'pdf,jpg,jpeg,png' ), self::file( 'insurance', __( 'Insurance certificate', '2ranq-forms' ), false, 1, 'pdf' ), self::consent( 'consent' ), ), ), /* ------------------------------------------------ identity checks */ 'verification' => array( 'name' => __( 'Identity verification', '2ranq-forms' ), 'description' => __( 'Three steps: details, identity document, proof of address.', '2ranq-forms' ), 'group' => 'verification', 'fields' => array( self::heading( 'h1', __( 'Your details', '2ranq-forms' ), __( 'Everything here is stored on your own server, nowhere else.', '2ranq-forms' ) ), self::field( 'name', 'name', __( 'Full legal name', '2ranq-forms' ), true ), self::field( 'birth', 'date', __( 'Date of birth', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'nationality', 'text', __( 'Nationality', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'address', 'address', __( 'Residential address', '2ranq-forms' ), true ), self::step( 'step1', __( 'Your details', '2ranq-forms' ), __( 'Continue to your document', '2ranq-forms' ) ), self::heading( 'h2', __( 'Identity document', '2ranq-forms' ), __( 'Passport, national ID or driving licence. Photos are fine.', '2ranq-forms' ) ), self::choice_field( 'doc_type', 'radio', __( 'Which document', '2ranq-forms' ), true, array( __( 'Passport', '2ranq-forms' ), __( 'National ID card', '2ranq-forms' ), __( 'Driving licence', '2ranq-forms' ), ) ), self::field( 'doc_number', 'text', __( 'Document number', '2ranq-forms' ), true ), self::field( 'doc_expiry', 'date', __( 'Expiry date', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::file( 'doc_front', __( 'Front of the document', '2ranq-forms' ), true, 1, 'jpg,jpeg,png,pdf' ), self::file( 'doc_back', __( 'Back of the document', '2ranq-forms' ), false, 1, 'jpg,jpeg,png,pdf' ), self::step( 'step2', __( 'Identity document', '2ranq-forms' ), __( 'Continue to proof of address', '2ranq-forms' ) ), self::heading( 'h3', __( 'Proof of address', '2ranq-forms' ), __( 'A utility bill or bank statement from the last three months.', '2ranq-forms' ) ), self::file( 'proof', __( 'Proof of address', '2ranq-forms' ), true, 2, 'jpg,jpeg,png,pdf' ), self::consent( 'consent', __( 'I confirm these documents are mine and are current', '2ranq-forms' ) ), ), ), 'document-upload' => array( 'name' => __( 'Document upload', '2ranq-forms' ), 'description' => __( 'A short form built around one thing: sending files safely.', '2ranq-forms' ), 'group' => 'verification', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'reference', 'text', __( 'Reference number', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'kind', 'select', __( 'What are you sending', '2ranq-forms' ), true, array( __( 'Signed contract', '2ranq-forms' ), __( 'Invoice', '2ranq-forms' ), __( 'Identity document', '2ranq-forms' ), __( 'Something else', '2ranq-forms' ), ) ), self::file( 'files', __( 'Your files', '2ranq-forms' ), true, 5, 'pdf,doc,docx,jpg,jpeg,png' ), self::field( 'notes', 'textarea', __( 'Anything we should know', '2ranq-forms' ), false, array( 'rows' => 3 ) ), ), ), 'patient-intake' => array( 'name' => __( 'Patient intake', '2ranq-forms' ), 'description' => __( 'Two steps: contact details, then health history.', '2ranq-forms' ), 'group' => 'verification', 'fields' => array( self::heading( 'h1', __( 'Your details', '2ranq-forms' ), '' ), self::field( 'name', 'name', __( 'Full name', '2ranq-forms' ), true ), self::field( 'birth', 'date', __( 'Date of birth', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), false ), self::field( 'emergency', 'text', __( 'Emergency contact', '2ranq-forms' ), false ), self::step( 'step1', __( 'Your details', '2ranq-forms' ), __( 'Continue to health history', '2ranq-forms' ) ), self::heading( 'h2', __( 'Health history', '2ranq-forms' ), __( 'Only what is relevant. You can tell us the rest in person.', '2ranq-forms' ) ), self::field( 'reason', 'textarea', __( 'Why are you coming in', '2ranq-forms' ), true, array( 'rows' => 4 ) ), self::field( 'medication', 'textarea', __( 'Current medication', '2ranq-forms' ), false, array( 'rows' => 3 ) ), self::field( 'allergies', 'textarea', __( 'Allergies', '2ranq-forms' ), false, array( 'rows' => 3 ) ), self::consent( 'consent', __( 'I agree to the practice privacy policy', '2ranq-forms' ) ), ), ), /* ------------------------------------------------ support */ 'support' => array( 'name' => __( 'Support ticket', '2ranq-forms' ), 'description' => __( 'Priority, what happened and a screenshot.', '2ranq-forms' ), 'group' => 'support', 'fields' => array( self::field( 'name', 'text', __( 'Your name', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'order', 'text', __( 'Order or account number', '2ranq-forms' ), false ), self::choice_field( 'priority', 'radio', __( 'How urgent is it', '2ranq-forms' ), true, array( __( 'I cannot work at all', '2ranq-forms' ), __( 'Something is broken but I can work around it', '2ranq-forms' ), __( 'A question, no rush', '2ranq-forms' ), ) ), self::field( 'problem', 'textarea', __( 'What happened', '2ranq-forms' ), true, array( 'rows' => 6 ) ), self::file( 'screenshot', __( 'Screenshot', '2ranq-forms' ), false, 3, 'jpg,jpeg,png,gif' ), ), ), 'bug-report' => array( 'name' => __( 'Bug report', '2ranq-forms' ), 'description' => __( 'Steps, expected and actual. For software teams.', '2ranq-forms' ), 'group' => 'support', 'fields' => array( self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true ), self::field( 'where', 'text', __( 'Where did it happen', '2ranq-forms' ), true ), self::field( 'steps', 'textarea', __( 'What did you do', '2ranq-forms' ), true, array( 'rows' => 4 ) ), self::field( 'expected', 'textarea', __( 'What did you expect', '2ranq-forms' ), true, array( 'rows' => 3 ) ), self::field( 'actual', 'textarea', __( 'What happened instead', '2ranq-forms' ), true, array( 'rows' => 3 ) ), self::field( 'browser', 'text', __( 'Browser and device', '2ranq-forms' ), false ), self::file( 'evidence', __( 'Screenshot or recording', '2ranq-forms' ), false, 2 ), ), ), /* ------------------------------------------------ sign ups and events */ 'newsletter' => array( 'name' => __( 'Newsletter sign up', '2ranq-forms' ), 'description' => __( 'One field and consent. Nothing more.', '2ranq-forms' ), 'group' => 'signup', 'fields' => array( self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true ), self::consent( 'consent', __( 'Yes, send me the newsletter', '2ranq-forms' ) ), ), ), 'event-signup' => array( 'name' => __( 'Event registration', '2ranq-forms' ), 'description' => __( 'Who is coming, how many, and any dietary needs.', '2ranq-forms' ), 'group' => 'signup', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'company', 'text', __( 'Company', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::field( 'guests', 'number', __( 'How many are coming', '2ranq-forms' ), true, array( 'size' => 'half', 'min' => 1, 'max' => 20 ) ), self::choice_field( 'session', 'select', __( 'Which session', '2ranq-forms' ), true, array( __( 'Morning', '2ranq-forms' ), __( 'Afternoon', '2ranq-forms' ), __( 'Both', '2ranq-forms' ), ), array( 'size' => 'half' ) ), self::field( 'dietary', 'text', __( 'Dietary requirements', '2ranq-forms' ), false ), ), ), 'volunteer' => array( 'name' => __( 'Volunteer sign up', '2ranq-forms' ), 'description' => __( 'Availability and what they would like to help with.', '2ranq-forms' ), 'group' => 'signup', 'fields' => array( self::field( 'name', 'name', __( 'Your name', '2ranq-forms' ), true ), self::field( 'email', 'email', __( 'Email address', '2ranq-forms' ), true, array( 'size' => 'half' ) ), self::field( 'phone', 'phone', __( 'Phone', '2ranq-forms' ), false, array( 'size' => 'half' ) ), self::choice_field( 'days', 'checkbox', __( 'When are you free', '2ranq-forms' ), true, array( __( 'Weekday mornings', '2ranq-forms' ), __( 'Weekday evenings', '2ranq-forms' ), __( 'Weekends', '2ranq-forms' ), ) ), self::choice_field( 'help', 'checkbox', __( 'What would you like to help with', '2ranq-forms' ), false, array( __( 'Events', '2ranq-forms' ), __( 'Admin', '2ranq-forms' ), __( 'Driving', '2ranq-forms' ), __( 'Anything you need', '2ranq-forms' ), ) ), self::field( 'about', 'textarea', __( 'Tell us a little about yourself', '2ranq-forms' ), false, array( 'rows' => 4 ) ), ), ), /* ------------------------------------------------ opinions */ 'feedback' => array( 'name' => __( 'Feedback', '2ranq-forms' ), 'description' => __( 'A rating and a comment. Short on purpose.', '2ranq-forms' ), 'group' => 'feedback', 'fields' => array( self::field( 'rating', 'rating', __( 'How did we do', '2ranq-forms' ), true ), self::field( 'comment', 'textarea', __( 'What could we do better', '2ranq-forms' ), false, array( 'rows' => 5 ) ), self::field( 'email', 'email', __( 'Email, if you want a reply', '2ranq-forms' ), false ), ), ), 'survey' => array( 'name' => __( 'Customer survey', '2ranq-forms' ), 'description' => __( 'Two short steps so it does not look long.', '2ranq-forms' ), 'group' => 'feedback', 'fields' => array( self::heading( 'h1', __( 'How was it', '2ranq-forms' ), __( 'Six questions, about two minutes.', '2ranq-forms' ) ), self::field( 'rating', 'rating', __( 'Overall, how satisfied are you', '2ranq-forms' ), true ), self::choice_field( 'again', 'radio', __( 'Would you use us again', '2ranq-forms' ), true, array( __( 'Definitely', '2ranq-forms' ), __( 'Probably', '2ranq-forms' ), __( 'Not sure', '2ranq-forms' ), __( 'No', '2ranq-forms' ), ) ), self::choice_field( 'best', 'select', __( 'What worked best', '2ranq-forms' ), false, array( __( 'Speed', '2ranq-forms' ), __( 'Price', '2ranq-forms' ), __( 'The people', '2ranq-forms' ), __( 'The result', '2ranq-forms' ), ) ), self::step( 'step1', __( 'How was it', '2ranq-forms' ), __( 'One more page', '2ranq-forms' ) ), self::heading( 'h2', __( 'In your words', '2ranq-forms' ), '' ), self::field( 'better', 'textarea', __( 'What should we do differently', '2ranq-forms' ), false, array( 'rows' => 4 ) ), self::field( 'quote', 'textarea', __( 'May we quote you', '2ranq-forms' ), false, array( 'rows' => 3 ) ), self::field( 'email', 'email', __( 'Email, if you want a reply', '2ranq-forms' ), false ), ), ), ); /** * Adding templates from modules. * * @param array $templates The templates. */ return apply_filters( 'ranq_forms_templates', $templates ); } /** * A single template, or null. * * @param string $key The template key. * * @return array|null */ public static function get( $key ) { $all = self::all(); $key = sanitize_key( $key ); return isset( $all[ $key ] ) ? $all[ $key ] : null; } /** * How many steps a template has. * * @param array $template The template. * * @return int */ public static function steps( $template ) { $breaks = 0; foreach ( $template['fields'] as $field ) { if ( isset( $field['type'] ) && 'pagebreak' === $field['type'] ) { $breaks++; } } return $breaks + 1; } /** * Builds an ordinary field. * * @param string $id The field key. * @param string $type The field type. * @param string $label The label. * @param bool $required Whether it is required. * @param array $extra Extra settings. * * @return array */ private static function field( $id, $type, $label, $required = false, $extra = array() ) { return array_merge( array( 'id' => $id, 'type' => $type, 'label' => $label, 'required' => (bool) $required, ), $extra ); } /** * A page break, that is the end of one step. * * @param string $id The key. * @param string $name The step name, shown in the progress bar. * @param string $next The text on the button that leads onward. * * @return array */ private static function step( $id, $name, $next ) { return array( 'id' => $id, 'type' => 'pagebreak', 'label' => $name, 'next_text' => $next, 'prev_text' => __( 'Back', '2ranq-forms' ), ); } /** * A heading with text inside the form. * * @param string $id The key. * @param string $title The heading. * @param string $text The text underneath. * * @return array */ private static function heading( $id, $title, $text ) { return array( 'id' => $id, 'type' => 'content', 'label' => $title, 'text' => $text, ); } /** * A file upload field. * * @param string $id The key. * @param string $label The label. * @param bool $required Whether it is required. * @param int $max How many files. * @param string $types The allowed types. * * @return array */ private static function file( $id, $label, $required = false, $max = 1, $types = 'pdf,doc,docx,jpg,jpeg,png' ) { return array( 'id' => $id, 'type' => 'file', 'label' => $label, 'required' => (bool) $required, 'max_files' => (int) $max, 'file_types' => $types, ); } /** * A consent checkbox. * * @param string $id The key. * @param string $label The text. * * @return array */ private static function consent( $id, $label = '' ) { $text = $label ? $label : __( 'I agree to the privacy policy', '2ranq-forms' ); return array( 'id' => $id, 'type' => 'checkbox', 'label' => __( 'Consent', '2ranq-forms' ), 'required' => true, 'choices' => array( array( 'label' => $text, 'value' => 'yes', 'default' => false, ), ), ); } /** * Builds a field with offered choices. * * @param string $id The field key. * @param string $type The field type. * @param string $label The label. * @param bool $required Whether it is required. * @param array $labels The choice labels. * @param array $extra Extra settings. * * @return array */ /** * One option for the image choice field. * * @param string $label The label. * @param string $value The value that is sent. * @param string $image A file out of `assets/img/`. * @param string $meta The small line under the label. * @param bool $disabled Whether the option is currently unavailable. * * @return array */ private static function picture( $label, $value, $image, $meta, $disabled = false ) { return array( 'label' => $label, 'value' => $value, 'default' => false, 'image' => RANQ_FORMS_URL . 'assets/img/' . $image, 'meta' => $meta, 'disabled' => (bool) $disabled, ); } private static function choice_field( $id, $type, $label, $required, $labels, $extra = array() ) { $choices = array(); foreach ( $labels as $index => $text ) { $choices[] = array( 'label' => $text, 'value' => sanitize_title( $text ) ? sanitize_title( $text ) : 'opt_' . ( $index + 1 ), 'default' => false, ); } return array_merge( array( 'id' => $id, 'type' => $type, 'label' => $label, 'required' => (bool) $required, 'choices' => $choices, ), $extra ); } }