diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e41034a..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -build -node_modules -.DS_Store -site diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md deleted file mode 100644 index da37213..0000000 --- a/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Welcome to MkDocs - -For full documentation visit [mkdocs.org](http://mkdocs.org). - -## Commands - -* `mkdocs new [dir-name]` - Create a new project. -* `mkdocs serve` - Start the live-reloading docs server. -* `mkdocs build` - Build the documentation site. -* `mkdocs help` - Print this help message. - -## Project layout - - mkdocs.yml # The configuration file. - docs/ - index.md # The documentation homepage. - ... # Other markdown pages, images and other files. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/__init__.pyc b/__init__.pyc new file mode 100644 index 0000000..c218b94 Binary files /dev/null and b/__init__.pyc differ diff --git a/base.html b/base.html new file mode 100644 index 0000000..b19a1c8 --- /dev/null +++ b/base.html @@ -0,0 +1,118 @@ + + + +
+ + + + {% if page_description %}{% endif %} + {% if site_author %}{% endif %} + {% block htmltitle %} +This is a suite of code that empowers your team to prototype in a static pattern library and then import the 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.
+ +It converts an library of JSON Schemas into Drupal paragraph bundles, and the JSON schema properties are converted into Drupal fields.
+With a library of patterns created in Pattern Builder, we need a method for creating each Drupal admin interface that allow users to enter the data needed for each template.
+As a content admin, you may want to create a customizable content type(s) which include entity references to smaller content patterns, such as field collection bundles. These bundles will be built to match the defined components from the Style guide. This would expose the ability to both create content and control the ordering, layout, and design from within the node editing interface, and would be fully revisionable. Additionally, editors would be able reference & include existing view blocks within the field groups. Editors could then apply data attributes such as layout and theme to these view blocks or field collections.
+Tech Setup
+Set up the import paths
+Use Drush to run the pattern builder import command
+drush pbi
View the imported patterns now stored as paragraph bundles
+Manage Fields on the (new) content type,
+Manage Display: Set the display format on the paragraph field to "Patternbuilder rendered items"
+Drush Commands
+Imports patterns from defined library
+Remove imported patterns from Drupal
+The schema used by Pattern Builder is based on JSON Schema with customizations for the Drupal importer.
+Property Types:
+Hidden on the edit form
+"options: { "hidden": true }
Read-only on the edit form
+"readonly": true
Non-imported properties:
+If a property does not need to be imported as a Drupal field, then it can be flagged to not import it with:
+"options: { "import": false }
Textarea
+Textareas are imported to a Drupal field type of "text_long". A schema property is consider to be a textarea if one of the following is true:
+"format": "textarea"
OR "format": "html"
WYSIWYG / Filtered text
+Filter text in Drupal provides the user with the Input Format selector. These commonly are configured to use a WYSIWYG editor. +A schema property is determined to allow filtered text if the following is set:
+"format": "html"
Collapsible Field Groups and Field Collections
+The field_group module is required by the importer in order to provide basic single level grouping. The schema can control the collapsibility of a group of properties with the following:
+Schema:
+"options": {
+ "collapsed": true,
+ "disable_collapse": false
+ }
Form Grid Layout
+This provides the ability to display grid style form elements.
+Schema:
+"options": {
+ "grid_columns": 2
+ },
+ "items": {
+ "format": "grid"
+ }
Paragraphs preview display view mode
+The importer can automatically setup up the "Paragraphs Editor Preview" view mode if the property is configured as "preview". The importer has some default formatters for some common fields (text, image). Refer to the patternbuilder_importer.api.php for hooks that allow setting custom formatters for the preview view mode.
+"options: { "preview": true }
The following are optional Drupal modules that are supported natively by the Pattern Builder Importer. If these modules are enabled on the site, then the magic happens automatically.
+Media (https://www.drupal.org/project/media)
+Media Internet - Submodule of Media (https://www.drupal.org/project/media)
+Media YouTube (https://www.drupal.org/project/media_youtube)
+Link (https://www.drupal.org/project/link)
+Field Collection (https://www.drupal.org/project/field_collection)
+Field Collection Fieldset (https://www.drupal.org/project/field_collection_fieldset)
+Field Multiple Extended (https://www.drupal.org/project/field_multiple_extended)
+After any import, check the logs to verify that there were no issues during the import. All errors and warnings are logged via the Drupal watchdog() function. +One of the following modules should be enabled on the site:
+WARNING: "There were no schema files found to import."
+The Pattern Builder module scans the schema directory for files with the .json extension. This message is logged if no schema files were found.
+WARNING: 'There were no schema files found for the following: schema01, schema02.'
+This message is logged when importing specific schemas and the importer cannot find the schema files.
+Example: "drush pbi schema01 schema02"
+The files schema01.json and schema02.json cannot be found in the schema directories configured at "admin/config/content/patternbuilder".
+WARNING: 'The schema file does not exist: "file:///path/to/schemas/schema01.json"'
+This message is logged if the schema file was registered but the file could not be found when attempting to load it.
+WARNING: 'The schema file name contains an invalid hyphen: "file:///path/to/schemas/schema01.json"'
+The schema file names cannot contain a hyphen. The file name is used for the pattern's machine name and paragraph bundle name. The hyphens are replaced with underscores when using it as a paragraph bundle, therefore if the name has a hyphen then it would not be reversible in this replacement. See paragraphs_bundle_load().
+WARNING: 'The schema file is empty: "file:///path/to/schemas/schema01.json"'
+This message is logged when the loaded file is empty.
+WARNING: 'The schema file could not be decoded: "file:///path/to/schemas/schema01.json". The most common cause of this error is malformed JSON in the schema file.'
+This message is logged when attempting to JSON decode the contents of the file. The most common cause of this error is malformed JSON in the schema file.
+WARNING: 'The schema file "file:///path/to/schemas/schema01.json" could not be loaded.'
+An unknown error occurred that prevented the schema file from being loaded and decoded.
+Please open a new issue on the patternbuilder module's drupal.org issue queue and attached the schema file that will not import.
+WARNING: 'Meta type not found for "someProperty" of type "not_found".'
+This occurs when the property type cannot be mapped to an importer meta type. See section "Property Types" above for available types.
+WARNING: 'Meta type handler could not be loaded for "someProperty" of type "object".'
+This occurs for the following: +- The property type could not be mapped to an import handler class. +- The dependencies were not met for the found import handler class.
+WARNING: 'Meta type not found for reference "someRefProperty".'
+This message is logged when the importer meta type could not be be determined for the referenced property. The importer's factory will attempt to resolve the reference using a field reference and a field group reference resolver.
+This could occur if the field or field group has not been created yet. If the referenced property is defined in another schema, then care should be take to ensure the import order - referenced property schema first, then the schema referencing it. +The order can be controlled with pattern types (see hook_patternbuilder_pattern_types) or the file names in the directory.
+WARNING: 'Base field creation failed for @field'
+The importer could not create the base field. Check the logs for other Drupal errors that occurred during the creation attempt.
+WARNING: 'Missing base field definition for @field'
+The importer reached a scenario where it is attempting to create a field instance but there is not field base created yet.
+This is an edge case. If encountered, please open an issue on the patternbuilder module's drupal.org issue queue.
+ERROR: 'field_123_text (text => text_long): Cannot change an existing field's type.'
+This error occurs when the field type determine from the property's schema is different than the existing field's type in Drupal.
+The patternbuilder.install provides a helper function to convert text fields. This should be added to an update function before the fields are imported.
+/**
+ * Convert awesome_pattern text property to a long text field.
+ */
+function mymodule_update_7123() {
+ $pattern_name = 'awesome_pattern';
+ $property_name = 'text';
+ $field_type_new = 'text_long';
+
+ $instance = patternbuilder_field_info_property_instance($pattern_name, array($property_name));
+ if (!empty($instance['field_name'])) {
+ module_load_install('patternbuilder');
+ $converted = patternbuilder_convert_text_field($field_name, $new_type);
+ if ($converted) {
+ // Import schema to allow the importer to set any customizations for the
+ // field and instances.
+ patternbuilder_importer_import_schemas(array($pattern_name));
+ }
+ else {
+ $t = get_t();
+ $error_message = $t('@pattern @property could not be converted.', array(
+ '@pattern' => $pattern_name,
+ '@property' => implode('.', $property_names),
+ ));
+
+ if ($converted === FALSE) {
+ // Hard fail.
+ throw new DrupalUpdateException($error_message);
+ }
+ else {
+ // Soft fail for incomplete data or conversion not allowed.
+ watchdog('mymodule_update_7123', $error_message);
+ }
+ }
+ }
+}
+
+
+Allowed Drupal field type conversions via patternbuilder_convert_text_field():
+ERROR: 'The property references a schema that is not imported due to the status "inactive": "schema_really_old.json#/properties/display_title"'
+This message is logged if the referenced property's schema has never been imported and there is a property referencing it.
+A referenced Drupal field cannot be found if the schema was never imported to a paragraph bundle.
+WARNING: 'The property references a schema that is not creatable due to the status "deprecated": "schema_old.json#/properties/display_title"'
+This message is logged if the referenced property's schema is not creatable and there is a property referencing it.
+WARNING: 'The paragraphs field @field_name references a schema that is not imported due to the status "inactive", schema: schema_really_old.json'
+The allowed schemas references a schema that is not imported based on the pattern's status. The "inactive" status is provided by the patternbuilder module.
+In Drupal, this refers to the paragraphs field's allowed bundles (schemas) which must be available on the site. This is a WARNING since this only reduces the allowed bundle options and does not block the import.
+WARNING: 'The paragraphs field @field_name references a schema that is not creatable due to the status "deprecated", schema: schema_old.json'
+The allowed schemas references a schema that is not creatable based on the pattern's status. The "inactive" and "deprecated" statuses are provided by the patternbuilder module.
+In Drupal, this refers to the paragraphs field's allowed bundles (schemas) which must be allowed to be created on the site. This is a WARNING since this only reduces the allowed bundle options and does not block the import.
+WARNING: 'Child fields could not be created for field collection field_124_some_collection'
+This is logged in the Field Collection import handler when the field collection field instance was not created. The field collection field must be created before attached fields to the field collection entity bundle.
+ +