-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathPatternLibraryPluginInterface.php
More file actions
69 lines (61 loc) · 2.24 KB
/
Copy pathPatternLibraryPluginInterface.php
File metadata and controls
69 lines (61 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace Drupal\patternkit;
use Drupal\Core\Extension\Extension;
use Drupal\patternkit\Entity\PatternInterface;
/**
* Service that renders a collection of patterns.
*/
interface PatternLibraryPluginInterface {
/**
* Fetches and loads all assets for a provided Pattern.
*
* @param \Drupal\patternkit\Entity\PatternInterface $pattern
* The pattern instance to load assets for.
* @param \Drupal\patternkit\PatternEditorConfig|null $config
* (Optional) The pattern configuration for this pattern instance.
*
* @return array
* The loaded assets for the pattern. Should have the following keys:
* - string template
* A renderable template string.
* - array schema
* A PHP Schema for the Pattern.
*/
public function fetchAssets(PatternInterface $pattern, ?PatternEditorConfig $config = NULL): array;
/**
* Returns renderable data or markup for a pattern editor.
*
* @param \Drupal\patternkit\Entity\PatternInterface|null $pattern
* If specified, return an editor customized for this pattern.
* @param \Drupal\patternkit\PatternEditorConfig|null $config
* Optional configuration settings for the editor.
*
* @return mixed
* The renderable pattern editor.
*/
public function getEditor(?PatternInterface $pattern = NULL, ?PatternEditorConfig $config = NULL);
/**
* Returns metadata for patterns within the provided collection path.
*
* @param \Drupal\Core\Extension\Extension $extension
* The extension to retrieve pattern metadata from.
* @param \Drupal\patternkit\PatternLibrary $library
* The metadata for the library that is being retrieved.
* @param string $path
* The path to the pattern library collection.
*
* @return \Drupal\patternkit\Entity\Pattern[]
* The resulting pattern metadata.
*/
public function getMetadata(Extension $extension, PatternLibrary $library, string $path): array;
/**
* Returns renderable data or markup for a provided array of patterns.
*
* @param \Drupal\patternkit\Entity\PatternInterface[] $assets
* An array of \Drupal\patternkit\Entity\PatternInterface to render.
*
* @return array
* Renderable data or markup.
*/
public function render(array $assets): array;
}