Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backstop_generator-3143184
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
backstop_generator-3143184
Commits
bfd7490a
Commit
bfd7490a
authored
6 years ago
by
Ryan Bateman
Browse files
Options
Downloads
Patches
Plain Diff
Viewports dynamically drawing from configuration, output json configuration is functional!
parent
7e574957
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/BackstopConfigRetrieverService.php
+42
-17
42 additions, 17 deletions
src/BackstopConfigRetrieverService.php
with
42 additions
and
17 deletions
src/BackstopConfigRetrieverService.php
+
42
−
17
View file @
bfd7490a
...
...
@@ -11,26 +11,52 @@ class BackstopConfigRetrieverService {
protected
$configuration_object
;
public
function
__construct
()
{
//$this->configuration_object = $config->get('pre_defined_pages_table
');
$config
=
\Drupal
::
config
(
'backstop_generator.backstopconfiguration
'
);
$this
->
configuration_object
=
array
();
$this
->
configuration_object
[
'id'
]
=
strtolower
(
str_replace
(
' '
,
'_'
,
\Drupal
::
config
(
'system.site'
)
->
get
(
'name'
)));
$this
->
configuration_object
[
'viewports'
]
=
array
();
$this
->
configuration_object
[
'viewports'
][
0
]
=
array
(
'label'
=>
'phone'
,
'width'
=>
320
,
'height'
=>
480
);
$this
->
configuration_object
[
'viewports'
][
1
]
=
array
(
'label'
=>
'tablet'
,
'width'
=>
1024
,
'height'
=>
768
);
$this
->
configuration_object
[
'viewports'
][
2
]
=
array
(
'label'
=>
'desktop'
,
'width'
=>
1920
,
'height'
=>
1080
);
if
(
$config
->
get
(
'viewports.Mobile'
))
{
$viewport
=
array
(
'label'
=>
'Mobile'
,
'width'
=>
320
,
'height'
=>
480
);
array_push
(
$this
->
configuration_object
[
'viewports'
],
$viewport
);
}
if
(
$config
->
get
(
'viewports.Tablet'
))
{
$viewport
=
array
(
'label'
=>
'Tablet'
,
'width'
=>
1024
,
'height'
=>
768
);
array_push
(
$this
->
configuration_object
[
'viewports'
],
$viewport
);
}
if
(
$config
->
get
(
'viewports.HD'
))
{
$viewport
=
array
(
'label'
=>
'HD'
,
'width'
=>
1920
,
'height'
=>
1080
);
array_push
(
$this
->
configuration_object
[
'viewports'
],
$viewport
);
}
if
(
$config
->
get
(
'viewports.HD+'
))
{
$viewport
=
array
(
'label'
=>
'HD+'
,
'width'
=>
2560
,
'height'
=>
1440
);
array_push
(
$this
->
configuration_object
[
'viewports'
],
$viewport
);
}
if
(
$config
->
get
(
'viewports.UHD'
))
{
$viewport
=
array
(
'label'
=>
'UHD'
,
'width'
=>
3840
,
'height'
=>
2160
);
array_push
(
$this
->
configuration_object
[
'viewports'
],
$viewport
);
}
$this
->
configuration_object
[
'onBeforeScript'
]
=
"chromy/onBefore.js"
;
$this
->
configuration_object
[
'onReadyScript'
]
=
"chromy/onReady.js"
;
$this
->
configuration_object
[
'scenarios'
]
=
array
();
...
...
@@ -49,7 +75,6 @@ class BackstopConfigRetrieverService {
$this
->
configuration_object
[
'debug'
]
=
false
;
$this
->
configuration_object
[
'debugWindow'
]
=
false
;
$config
=
\Drupal
::
config
(
'backstop_generator.backstopconfiguration'
);
$pages_config_array
=
$config
->
get
(
'pre_defined_pages_table'
);
$randomExclude
=
array
();
foreach
(
$pages_config_array
as
$key
=>
$value
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment