Skip to content
Snippets Groups Projects
Commit bfd7490a authored by Ryan Bateman's avatar Ryan Bateman
Browse files

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
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment