Skip to content

Commit

Permalink
Update patterns to 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopeek committed Apr 30, 2017
1 parent 8f7aecd commit 2672900
Show file tree
Hide file tree
Showing 22 changed files with 89 additions and 9 deletions.
9 changes: 9 additions & 0 deletions _data/chunks/imgResponsiveRowSrcset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
id: 359
name: imgResponsiveRowSrcset
description: 'A row template for the responsiveImgSrcset snippet, containing srcset properties for use inside an <img> tag.'
category: a_images
properties: 'a:0:{}'

-----

[[+src:pthumb=`[[+crop]]&w=[[+width:lte=`[[+breakpoint]]`:then=`[[+width]]`:else=`[[+breakpoint]]`]]&q=[[+quality]]`]] [[+breakpoint]]w
46 changes: 46 additions & 0 deletions _data/snippets/responsiveImgSrcset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
id: 115
name: responsiveImgSrcset
description: 'Generate a number of srcset properties, for use inside an img tag.'
category: f_framework
properties: 'a:0:{}'

-----

/**
* responsiveImgSrcset
*
* Generates a number of srcset properties, for use inside an <img> tag.
*
* The dimensions for each srcset image are defined inside the
* responsive_img_breakpoints configuration setting.
*
* @author: Hugo Peek
* @license: MIT
*/

$src = $modx->getOption('src', $scriptProperties, '');
$crop = $modx->getOption('crop', $scriptProperties, '');
$width = $modx->getOption('width', $scriptProperties, '');
$tpl = $modx->getOption('tpl', $scriptProperties, 'imgResponsiveRowSrcset');
$placeholder = $modx->getOption('toPlaceholder', $scriptProperties, '');

// Output filters are also processed when the input is empty, so check for that.
if ($breakpoints == '') { return ''; }
$breakpoints = explode(',', $breakpoints);

// Process each breakpoint individually
foreach ($breakpoints as $key => $value) {
$output[] = $modx->getChunk($tpl, array(
'src' => $src,
'crop' => $crop,
'width' => $width,
'breakpoint' => $value,
));
}

if ($placeholder) {
$modx->toPlaceholder($placeholder, implode(",\n", $output));
return '';
} else {
return implode(",\n", $output);
}
2 changes: 1 addition & 1 deletion _data/template_variables/organization-sector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: organization_sector
caption: 'Organization sector'
description: 'What type of organization is this?'
category: 'Org. - Information'
elements: 'Public (government)==public||Private business==private||Non-profit organization==community'
elements: '--- Select a sector ---==||Public (government)==public||Private business==private||Non-profit organization==community'
rank: 5
default_text: ''
properties: 'a:0:{}'
Expand Down
1 change: 1 addition & 0 deletions _data/template_variables/organization-url.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ id: 75
type: text
name: organization_url
caption: 'Organization website'
description: 'Please fill in the complete URL (including http(s)://).'
category: 'Org. - Information'
elements: ''
rank: 20
Expand Down
2 changes: 1 addition & 1 deletion _data/template_variables/overview-img-portrait.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: 7
type: imageplus
name: overview_img_portrait
caption: 'Image (Portrait)'
description: 'This is a standing image in 3:4 aspect ratio, best suited for floating left or right of content.'
description: 'This is a standing image in 3:4 aspect ratio, best suited for floating left or right of content, or for display on mobile devices.'
category: 'Overview - Image'
elements: ''
rank: 2
Expand Down
1 change: 1 addition & 0 deletions _data/template_variables/person-url.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ id: 82
type: text
name: person_url
caption: 'Personal website or blog'
description: 'Please fill in the complete URL (including http(s)://).'
category: 'Person - Information'
elements: ''
rank: 10
Expand Down
2 changes: 1 addition & 1 deletion _data/template_variables/rating-value.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
id: 57
type: options
type: option
name: rating_value
caption: 'Rating value'
description: 'How did the user value this product or service?'
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-facebook.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 47
type: url
type: text
name: social_facebook
caption: 'Facebook page'
description: 'Please fill in the complete URL (including http(s)://).'
category: Social
elements: ''
rank: 3
Expand Down
1 change: 1 addition & 0 deletions _data/template_variables/social-github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ id: 52
type: text
name: social_github
caption: 'Github account'
description: 'Only fill in the account name (the part after https://github.com/).'
category: Social
elements: ''
rank: 20
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-googleplus.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 51
type: url
type: text
name: social_googleplus
caption: 'Google+ profile'
description: 'Please fill in the complete URL (including http(s)://).'
category: Social
elements: ''
rank: 11
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-instagram.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 48
type: url
type: text
name: social_instagram
caption: 'Instagram profile'
description: 'Only fill in the account name (the part after https://instagram.com/).'
category: Social
elements: ''
rank: 4
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-linkedin.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 46
type: url
type: text
name: social_linkedin
caption: 'LinkedIn profile'
description: 'Please fill in the complete URL (including http(s)://).'
category: Social
elements: ''
rank: 2
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-pinterest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 49
type: url
type: text
name: social_pinterest
caption: 'Pinterest board'
description: 'Please fill in the complete URL (including http(s)://).'
category: Social
elements: ''
rank: 5
Expand Down
3 changes: 2 additions & 1 deletion _data/template_variables/social-youtube.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id: 50
type: url
type: text
name: social_youtube
caption: 'Youtube channel'
description: 'Please fill in the complete URL (including http(s)://).'
category: Social
elements: ''
rank: 10
Expand Down
2 changes: 2 additions & 0 deletions _data/template_variables_access/55.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 55
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/76.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 76
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/78.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 78
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/79.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 79
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/80.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 80
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/81.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 81
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/82.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 82
templateid: 14
2 changes: 2 additions & 0 deletions _data/template_variables_access/84.14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmplvarid: 84
templateid: 14

0 comments on commit 2672900

Please sign in to comment.