Skip to content

PatternBuilder/pattern-builder-drupal

Repository files navigation

Pattern Builder

The Pattern Builder Module empowers your team to prototype in a static pattern library and then import your designs and content data model into Drupal with a single drush command. Need to update your design? No problem! Just update and QA the code in your pattern library and import those changes in seconds.

Installation

Requirements

Optional Extensions

Setup Walkthrough

  • Make sure composer is installed
  • Install D7
  • drush en patternbuilder -y
  • drush en patternbuilder_importer -y
  • CD to sites/all/libraries
  • git clone https://github.com/PatternBuilder/pattern-builder-lib-php.git patternbuilder
  • cd patternbuilder && composer install
  • Create a templates and schemas folder (location is up to you)
  • Goto admin/config/content/patternbuilder set configuration to point to those folders
#schemas/foo.json#

{
  "type": "object",
  "properties": {
    “bar”: {
      "type": "string"
    }
  }
}
#templates/foo.twig#

{{bar}}
  • Run pattern builder importer drush pbi or drush pbi foo
  • Goto/Create content type
  • Manage fields
  • Add new field -> Paragraphs
  • Manage display
  • Change format to “Patternbuilder rendered item”
  • Create new content type and add foo paragraph
  • You'll have a single field bar that will be rendered directly through foo.twig