Skip to content

Commit fff9291

Browse files
committed
Merge branch 'release/7.2.24'
2 parents 1b03528 + dabf560 commit fff9291

File tree

10 files changed

+142
-22
lines changed

10 files changed

+142
-22
lines changed

Drush/EntityScaffolder/d7_1/Scaffolder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class Scaffolder extends ScaffolderBase {
1111
// @see http://php.net/version_compare.
12-
const VERSION = '7.2.18';
12+
const VERSION = '7.2.24';
1313

1414
const DEFAULT_TEMPLATE_DIR = __DIR__ . '/templates';
1515
const TEMPLATE_NAMESPACE = 'd7_1';

Drush/EntityScaffolder/d7_1/templates/field/entityreference/base/feature.content.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
),
2525
'sort' => array(
2626
'direction' => 'ASC',
27-
'property' => {% if target_sort_by_property is empty %}'title'{% else %}{{ target_sort_by_property }}{% endif %},
27+
'property' => {% if target_sort_by_property is empty %}'title'{% else %}'{{ target_sort_by_property }}'{% endif %},
2828
'type' => 'property',
2929
),
3030
'target_bundles' => array(
@@ -37,4 +37,4 @@
3737
),
3838
'translatable' => 0,
3939
'type' => 'entityreference',
40-
);
40+
);

Drush/EntityScaffolder/d7_1/templates/field/entityreference/instance/feature.content.twig

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,25 @@
4444
{% endif %}
4545
{% if widget_type == 'inline_entity_form' %}
4646
'module' => 'inline_entity_form',
47-
'settings' => array(),
47+
{% if widget_settings is not empty %}
48+
'settings' => array(
49+
'fields' => array(),
50+
{% if widget_settings.type_settings is not empty %}
51+
'type_settings' => array(
52+
'allow_clone' => {{ widget_settings.type_settings.allow_clone | default("0") }},
53+
'allow_existing' => {{ widget_settings.type_settings.allow_existing | default("0") }},
54+
'allow_new' => {{ widget_settings.type_settings.allow_new | default("0") }},
55+
'delete_references' => {{ widget_settings.type_settings.delete_references | default("0") }},
56+
'label_plural' => {{ widget_settings.type_settings.label_plural | default("nodes") }},
57+
'label_singular' => {{ widget_settings.type_settings.label_singular | default("node") }},
58+
'match_operator' => {{ widget_settings.type_settings.match_operator | default("CONTAINS") }},
59+
'override_labels' => {{ widget_settings.type_settings.override_labels | default("0") }},
60+
),
61+
{% endif %}
62+
),
63+
{% else %}
64+
'settings' => array(),
65+
{% endif %}
4866
'type' => 'inline_entity_form',
4967
{% endif %}
5068
{% if widget_type == 'entityreference_autocomplete' %}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
dependencies :
22
- file
33
- media
4-
- image
4+
- image
5+
variables :
6+
file_extensions :
7+
type : string
8+
placeholder : 'png gif jpg jpeg'
9+
required : false
10+
default : 'png gif jpg jpeg'
11+
description: Provide list of extensions seperated by space. Eg. 'png gif jpg jpeg'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
dependencies :
2+
- file
3+
- media
4+
- image
5+
variables :
6+
file_extensions :
7+
type : string
8+
placeholder : 'png gif jpg jpeg'
9+
required : false
10+
default : 'png gif jpg jpeg'
11+
description: Provide list of extensions seperated by space. Eg. 'png gif jpg jpeg'

Drush/EntityScaffolder/d7_1/templates/field/image/instance/feature.content.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'alt_field' => 1,
2626
'default_image' => 0,
2727
'file_directory' => '{{ entity_type }}/{{ bundle }}',
28-
'file_extensions' => 'png gif jpg jpeg',
28+
'file_extensions' => '{{ file_extensions }}',
2929
'max_filesize' => '',
3030
'max_resolution' => '',
3131
'min_resolution' => '',

Drush/EntityScaffolder/d7_1/templates/preprocess/es_helper/es_helper.module

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,35 @@ function es_helper_preprocess_brightcove_field_embed(array &$vars) {
385385
// Getting brightcove video id.
386386
$video_id = $video->getId();
387387
$video_name = $video->getName();
388+
$video_description = !empty($video->getDescription()) ? $video->getDescription() : $video->getName();
389+
$video_upload_data = $video->getCreatedAt();
390+
$video_thumbnail_url = !empty($video->getImages()['thumbnail']) ? $video->getImages()['thumbnail']->getSrc() : '';
388391

389392
// Creating the variables which we need in brightcove player template
390393
// for tracking purpose.
391394
$vars['brightcove_video_id'] = $video_id;
392395
$vars['video_name'] = $video_id . ':' . $video_name;
393396
$vars['id'] = es_helper_get_unique_video_id($video_id);
397+
$vars['video_description'] = $video_description;
398+
$vars['video_upload_data'] = $video_upload_data;
399+
$vars['video_thumbnail_url'] = $video_thumbnail_url;
400+
}
401+
402+
/**
403+
* Debug helper to show modules which can't be enabled.
404+
*/
405+
function es_helper_debug_modules_enabled($path = 'modules_enabled.txt') {
406+
$content = file_get_contents($path);
407+
if ($content) {
408+
$modules = explode("\n", $content);
409+
$modules = array_map('trim', $modules);
410+
$modules = array_filter($modules);
411+
foreach ($modules as $module) {
412+
if (!module_enable([$module])) {
413+
drupal_set_message(t("can't enable module %module", ['%module' => $module]));
414+
}
415+
}
416+
}
394417
}
395418

396419
/**

Drush/EntityScaffolder/d7_1/templates/preprocess/es_helper/es_helper.preprocess.default.inc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
$out = [];
2121
$items = [];
2222
// Extract each values into $items variable.
23-
foreach (element_children($render_array[$field_name]) as $key) {
24-
$items[] = $render_array[$field_name][$key];
25-
unset($render_array[$field_name][$key]);
23+
if (isset($render_array[$field_name]) && is_array($render_array[$field_name])) {
24+
// Extract each values into $items variable.
25+
foreach (element_children($render_array[$field_name]) as $key) {
26+
$items[] = $render_array[$field_name][$key];
27+
unset($render_array[$field_name][$key]);
28+
}
2629
}
30+
$weight = 0;
2731
// At this point `$render_array[$field_name]`
2832
// is an empty field template.
2933
foreach ($items as $item) {
@@ -32,7 +36,9 @@
3236
$v = $render_array[$field_name];
3337
$v['#label_display'] = 'hidden';
3438
$v['0'] = $item;
39+
$v['#weight'] = $weight;
3540
$out[] = $v;
41+
$weight++;
3642
}
3743
}
3844
return $out;

Drush/EntityScaffolder/potx/potx.inc

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,19 +1045,25 @@ function _potx_find_context($tf, $ti, $file, $function_name) {
10451045
// argument is coming up, which might have a key for context.
10461046
list($com, $arr, $par) = array($_potx_tokens[$ti], $_potx_tokens[$ti+1], $_potx_tokens[$ti+2]);
10471047
// @HACK check $arr[1] is empty or not before accessing it.
1048-
if ($com == ',' && !empty($arr[1]) && $arr[1] == 'array' && $par == '(') {
1048+
if ($com == ',' && ($forward = _potx_is_beginning_of_array($arr, $par))) {
10491049
$nesting = 0;
1050-
$ti += 3;
1050+
$ti += $forward;
10511051
// Go through to either the end of the array or to the key definition of
10521052
// context on the same nesting level.
10531053
while (!((is_array($_potx_tokens[$ti]) && (in_array($_potx_tokens[$ti][1], array('"context"', "'context'"))) && ($_potx_tokens[$ti][0] == T_CONSTANT_ENCAPSED_STRING) && ($nesting == 0)) ||
1054-
($_potx_tokens[$ti] == ')' && $nesting == -1))) {
1054+
(_potx_is_end_of_array($_potx_tokens[$ti]) && $nesting == -1))) {
10551055
$ti++;
10561056
if (!is_array($_potx_tokens[$ti])) {
1057-
if ($_potx_tokens[$ti] == ')') {
1057+
// Treat each () and [] pair as going into / out of nesting levels.
1058+
// There may be function or method calls as well as nested short
1059+
// arrays within the arguments list. The list may be similar to:
1060+
// array('langcode' => $obj->someMethod([])[2], 'context' => 'Long month name')
1061+
// or
1062+
// ['langcode' => $obj->someMethod(array())[2], 'context' => 'Long month name']
1063+
if ($_potx_tokens[$ti] == ')' || $_potx_tokens[$ti] == ']') {
10581064
$nesting--;
10591065
}
1060-
if ($_potx_tokens[$ti] == '(') {
1066+
if ($_potx_tokens[$ti] == '(' || $_potx_tokens[$ti] == '[') {
10611067
$nesting++;
10621068
}
10631069
}
@@ -1657,4 +1663,37 @@ function _potx_get_banned_strings($reset = FALSE, $dir = NULL) {
16571663

16581664
}
16591665
return $banned_strings;
1666+
}
1667+
1668+
/**
1669+
* Determines if processing an array.
1670+
*
1671+
* @param string|string[] $arr
1672+
* @param string|NULL $par
1673+
*
1674+
* @return int|FALSE
1675+
* The number to forward the current position forward to start processing the
1676+
* array. FALSE if not processing an array.
1677+
*/
1678+
function _potx_is_beginning_of_array($arr, $par) {
1679+
if ($arr === '[' && is_array($par)) {
1680+
return 2;
1681+
}
1682+
if (is_array($arr) && $arr[1] == 'array' && $par == '(') {
1683+
return 3;
1684+
}
1685+
return FALSE;
1686+
}
1687+
1688+
/**
1689+
* Determines if at the end of an array.
1690+
*
1691+
* @param string $token
1692+
* The token being processed.
1693+
*
1694+
* @return bool
1695+
* TRUE is at the end of an array, FALSE if not.
1696+
*/
1697+
function _potx_is_end_of_array($token) {
1698+
return $token == ')' || $token == ']';
16601699
}

docs/configurations/config.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ templates:
1717
dir: /.entity_scaffolder/factorial
1818

1919
# Pass the project specific directory locations.
20-
directories :
21-
theme : sites/all/themes/custom/my_custom_theme
22-
templates : sites/all/themes/custom/my_custom_theme/templates
23-
patternlab : sites/all/themes/custom/my_custom_theme/source
20+
directories:
21+
theme: sites/all/themes/custom/my_custom_theme
22+
templates: sites/all/themes/custom/my_custom_theme/templates
23+
patternlab: sites/all/themes/custom/my_custom_theme/source
24+
patternlab_image_data: sites/all/themes/custom/my_custom_theme/source/_patterns/01-atoms/image-picture
25+
patternlab:
26+
components:
27+
image: 'image-picture'
2428
```
2529
2630
### Key/value pairs
@@ -67,11 +71,23 @@ These can be supplied as such.
6771
6872
```yaml
6973
# Pass the project specific directory locations.
70-
directories :
74+
directories:
7175
# Location of custom theme
72-
theme : sites/all/themes/custom/my_custom_theme
76+
theme: sites/all/themes/custom/my_custom_theme
7377
# Location of template directory within the custom theme
74-
templates : sites/all/themes/custom/my_custom_theme/templates
78+
templates: sites/all/themes/custom/my_custom_theme/templates
7579
# Location of patternlab source folder.
76-
patternlab : sites/all/themes/custom/my_custom_theme/source
80+
patternlab: sites/all/themes/custom/my_custom_theme/source
81+
# Location where sample image data (as yaml files) for responsive image will be
82+
# generated based on picture mapping.
83+
patternlab_image_data: sites/all/themes/custom/my_custom_theme/source/_patterns/01-atoms/image-picture
84+
```
85+
86+
#### patternlab
87+
The following configuration along with `directories.patternlab_image_data` is used to generate the image data. `patternlab.components.image` should be the name of the image component.
88+
89+
```yaml
90+
patternlab:
91+
components:
92+
image: 'image-picture'
7793
```

0 commit comments

Comments
 (0)