Skip to content

Commit f2d0db9

Browse files
committed
Port module to Drupal 8
feat(Drupal 8)
1 parent fcdc2d7 commit f2d0db9

File tree

76 files changed

+13738
-2307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+13738
-2307
lines changed

README.md

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,55 @@
11
# PatternKit
2-
Panels-based plugin that wraps a PatternLab library of components.
2+
Drupal module that wraps a PatternLab library of patterns.
33

4-
This code will parse a pattern library (local or through REST endpoints) to generate a list of "content types" in panels that can be drag/dropped into panel variants.
4+
This code will parse a pattern library (local or through REST endpoints) to generate a list of blocks that can be drag/dropped into layouts.
55

66
If enabled, the configuration screen is simply an iframe wrapper of a simplified version of the PatternLab schema builder.
77

88
When pattern configurations are saved, the template is downloaded locally (to mitigate origin failures and lock in version at time of configuration.)
99

10-
Rendered twigs may contain drupal tokens, which are then processed in context.
10+
Rendered templates may contain drupal tokens, which are then processed in context.
1111

1212
## Installation
1313
Install the patternkit module as usual, and review the important variables below to determine if you would like to change the defaults.
1414

15-
Install the Twig library into /sites/all/libraries/Twig
16-
```
17-
git clone git://github.com/twigphp/Twig.git -b 1.x /tmp/Twig
18-
mv /tmp/Twig/lib/Twig ${DRUPALDIR}/sites/all/libraries/
19-
rm -rf /tmp/Twig
20-
```
21-
22-
The patternkit module by itself only provides the glue for other modules to present components. Define one by implementing ```hook_patternkit_library```
15+
The patternkit module by itself only provides the glue for other modules to present components. Define one by adding a 'patterns' section to your libraries.yml.
2316

2417
An example implementation follows
25-
```
26-
/**
27-
* Implements hook_patternkit_library().
28-
*/
29-
function webrh_patternkit_library() {
30-
$libraries = array();
31-
32-
$namespaces = array(
33-
'Web RH Patterns' => 'webrh/src/library',
34-
);
35-
36-
$module_path = drupal_get_path('module', 'webrh');
37-
foreach ($namespaces as $namespace => $path) {
38-
$lib_path = $module_path . DIRECTORY_SEPARATOR . $path;
39-
$libraries[] = new PatternkitDrupalTwigLib($namespace, $lib_path);
40-
}
41-
42-
return $libraries;
43-
}
18+
```YAML
19+
patternkit_example.pkexample:
20+
version: VERSION
21+
css:
22+
theme:
23+
lib/patternkit/dist/patternkit.css: {}
24+
js:
25+
lib/patternkit/dist/patternkit.min.js: {}
26+
patterns:
27+
atoms:
28+
lib/patternkit/src/atoms: {}
4429
```
4530
4631
There are two different plugins currently available,
47-
* PatternkitRESTLib
48-
* PatternkitDrupalTwigLib
32+
* PatternkitRESTLibrary
33+
* PatternkitTwigLibrary
4934
5035
Use the former for dynamic REST based components, and the latter for locally sourced.
5136
37+
You can create your own plugins if you'd like to add support for other library types. Feel free to [create a pull request](https://github.com/cybtachyon/patternkit/pulls) to have it added to the repo!
38+
5239
## Important Variables
5340
* ```patternkit_cache_enabled``` - Whether or not the metadata and render cache are enabled. (Disable during development)
5441
* ```patternkit_pl_host``` - The scheme://hostname:port/ of the PatternLab library host.
5542
* ```patternkit_default_module_ttl``` - How long the rendered pattern should be cached.
5643
* ```patternkit_show_errors``` - Whether or not to display messages on the site.
5744
* ```patternkit_log_errors``` - Whether or not to log errors to php error log.
5845

46+
## Definitions
47+
Most of the thinking and vernacular used in Patternkit is inspired by conversations that have happened around Design Systems. A great reference for this is [Brad Frost's Atomic Design Book](http://atomicdesign.bradfrost.com/).
48+
* **Category** The design system category for a pattern, e.g. _Atom_, _Molecule_, _Organism_.
49+
* **Design System** A modular and manageable approach to creating reusable design patterns for building GUI's. See http://atomicdesign.bradfrost.com/chapter-1/
50+
* **Pattern** A component, widget, or template that can be rendered to an HTML GUI.
51+
52+
5953
## TODOs
6054
* https://github.com/drupal-pattern-lab/roadmap/issues/8 Solve the problem of mapping Drupal fields to pattern Variables.
6155
* Error handling.
@@ -67,9 +61,8 @@ More documentation will be added.
6761
## Dependencies
6862
[PatternLab](https://github.com/pattern-lab/starterkit-twig-drupal-minimal)
6963
* Schema display support requires: https://github.com/pattern-lab/patternlab-php-core/issues/117
70-
*
7164

72-
# Proposed V2 Ecosystem
65+
# D7 v2.0.0 & D8 Ecosystem
7366
* Exists to solve this issue: https://github.com/drupal-pattern-lab/roadmap/issues/8
7467
* PatternLAB with Restful Extensions provides library + endpoints (Ported from PatternKit)
7568
* PatternKit provides Drupal endpoint consumer (renamed from PKPlugins)

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
{
22
"name": "cybtachyon/patternkit",
33
"authors": [
4+
{
5+
"name": "Derek Reese",
6+
"email": "[email protected]"
7+
},
48
{
59
"name": "Red Hat Inc.",
610
"email": "[email protected]"
711
}
812
],
13+
"license": "MIT",
914
"require": {},
1015
"config": {},
1116
"repositories": [],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
patternkit_cache_enabled: true
2+
patternkit_default_module_ttl: 560000
3+
patternkit_render_cache: true

include/api.inc

Lines changed: 0 additions & 18 deletions
This file was deleted.

include/patternkit_config_form.inc

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)