Grav Blueprints and Forms Setup

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Grav Blueprints and Forms Setup
Simple
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Grav Blueprints and Forms Setup

Blueprints in Grav — YAML description of form fields: for editing pages in admin and theme/plugin configuration. Form — plugin for creating contact and other forms directly in page frontmatter without PHP code.

Blueprints for Pages

Blueprint defines which fields editor sees when editing a page of given type. File located in user/blueprints/pages/ or user/themes/my-theme/blueprints/pages/.

# user/blueprints/pages/service-detail.yaml
title: Service Detail Page
extends@:
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      type: tabs
      active: 1
      fields:

        content:
          type: tab
          title: Content
          fields:
            header.intro:
              type: textarea
              label: Introduction
              help: Brief description for preview
              size: large
              rows: 3

            header.hero_image:
              type: filepicker
              label: Main Image
              preview_images: true
              folder: '@self'
              accept: ['image/jpeg', 'image/png', 'image/webp']

            header.features:
              type: list
              label: Features
              style: vertical
              fields:
                .icon:
                  type: text
                  label: CSS Icon Class
                  placeholder: 'icon-check'
                .text:
                  type: text
                  label: Feature Text

        seo:
          type: tab
          title: SEO
          fields:
            header.metadata.description:
              type: textarea
              label: Meta Description
              size: large
              rows: 2
              validate:
                max: 160

            header.metadata.keywords:
              type: text
              label: Meta Keywords

            header.canonical:
              type: url
              label: Canonical URL

        options:
          type: tab
          title: Settings
          fields:
            header.show_sidebar:
              type: toggle
              label: Show Sidebar
              default: 1
              options:
                1: Yes
                0: No

            header.template:
              type: select
              label: Output Template
              options:
                default: Standard
                wide: Wide
                fullscreen: Full Screen

Blueprint Field Types

Type Purpose
text Single-line text
textarea Multi-line text
toggle Toggle (bool)
select Dropdown list
checkboxes Multiple choice
filepicker File selection from media
list Repeatable field groups
array Key-value pairs
date Date
url URL with validation
number Numeric field
color Color picker
editor Markdown editor

Contact Form via Form Plugin

Form is described in page contact.md frontmatter:

---
title: Contacts
template: form

form:
  name: contact-form
  fields:
    name:
      label: Name
      type: text
      validate:
        required: true
        min: 2

    email:
      label: Email
      type: email
      validate:
        required: true

    phone:
      label: Phone
      type: tel
      placeholder: '+1 XXX XXX-XX-XX'

    service:
      label: Interested Service
      type: select
      options:
        web: Web Development
        app: Mobile App
        seo: SEO Promotion
        other: Other

    message:
      label: Message
      type: textarea
      validate:
        required: true
        min: 20
      rows: 5

    honeypot:
      type: honeypot   # bot protection

  buttons:
    submit:
      type: submit
      value: Submit
      classes: btn btn-primary

  process:
    - email:
        from: "{{ form.value.email }}"
        to: [email protected]
        subject: "Request from site: {{ form.value.name }}"
        body: "{% include 'forms/email/contact.html.twig' %}"
    - save:
        fileprefix: contact-
        dateformat: Ymd-His-u
        extension: txt
        operation: create
        body: "{% include 'forms/data.txt.twig' %}"
    - message: Thank you! We will contact you within 1 business day.
    - display: /thank-you

---

## Contact Us

Leave a request and we will respond during business hours.

Email Notification Template

{# user/themes/my-theme/templates/forms/email/contact.html.twig #}
<h2>New Request from Site</h2>
<table>
    <tr><td><strong>Name:</strong></td><td>{{ form.value.name }}</td></tr>
    <tr><td><strong>Email:</strong></td><td>{{ form.value.email }}</td></tr>
    <tr><td><strong>Phone:</strong></td><td>{{ form.value.phone }}</td></tr>
    <tr><td><strong>Service:</strong></td><td>{{ form.value.service }}</td></tr>
    <tr><td><strong>Message:</strong></td><td>{{ form.value.message }}</td></tr>
</table>

Email Plugin Configuration

# user/config/plugins/email.yaml
enabled: true
mailer:
  engine: smtp
  smtp:
    server: smtp.gmail.com
    port: 587
    encryption: tls
    user: [email protected]
    password: app-specific-password

from: [email protected]
from_name: My Site
to: [email protected]

Multi-Step Form

form:
  name: multistep-order
  fields:
    step1:
      type: section
      title: Step 1. Contacts
      fields:
        name:
          type: text
          label: Name
        email:
          type: email
          label: Email

    step2:
      type: section
      title: Step 2. Order Details
      fields:
        budget:
          type: select
          label: Budget
          options:
            small: up to $1000
            medium: $1000–5000
            large: more than $5000
        details:
          type: textarea
          label: Task Description

For step-by-step display, custom JS or form-wizard plugin is needed.