class LayoutFlexibleTemplate {
var $name = '';
var $title = '';
var $description;
var $rows = array();
public $is_new;
function __construct(array $config = array()) {
foreach ($config as $property => $property_value) {
$this->{$property} = $property_value;
}
if (empty($this->rows)) {
$uuid = new Uuid();
$this->rows[$uuid->generate()] = array(
'contains' => 'region_12',
'element' => 'header',
'classes' => '',
'container' => 'container',
'region_names' => array('region_0' => array('label' => t('Header'), 'name' => 'header', 'classes' => '')),
);
$this->rows[$uuid->generate()] = array(
'contains' => 'region_12',
'element' => '',
'classes' => '',
'container' => 'container',
'region_names' => array('region_0' => array('label' => t('Content'), 'name' => 'content', 'classes' => '')),
);
$this->rows[$uuid->generate()] = array(
'contains' => 'region_12',
'element' => 'footer',
'classes' => '',
'container' => 'container',
'region_names' => array('region_0' => array('label' => t('Footer'), 'name' => 'footer', 'classes' => '')),
);
}
}
function save() {
$data = array(
'name' => $this->name,
'title' => $this->title,
'description' => $this->description,
'rows' => $this->rows,
);
config('layout.flexible.' . $this->name)
->setData($data)
->save();
if (isset($this->is_new)) {
unset($this->is_new);
}
layout_reset_caches();
layout_flexible_reset_caches();
backdrop_theme_rebuild();
}
function delete() {
config('layout.flexible.' . $this->name)->delete();
layout_reset_caches();
layout_flexible_reset_caches();
backdrop_theme_rebuild();
}
}