mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
IMPROVEMENT: Page Default container type
This commit is contained in:
parent
f427afdcd3
commit
e6972464de
@ -10,6 +10,9 @@ SilverStripe\View\SSViewer:
|
|||||||
- '$public'
|
- '$public'
|
||||||
- '$default'
|
- '$default'
|
||||||
|
|
||||||
|
Page:
|
||||||
|
default_container_class: 'container'
|
||||||
|
|
||||||
#SilverStripe\Admin\LeftAndMain:
|
#SilverStripe\Admin\LeftAndMain:
|
||||||
# extra_requirements_javascript:
|
# extra_requirements_javascript:
|
||||||
# - 'colymba/gridfield-bulk-editing-tools:client/dist/js/main.js'
|
# - 'colymba/gridfield-bulk-editing-tools:client/dist/js/main.js'
|
||||||
|
@ -36,7 +36,7 @@ class ElementRows extends DataExtension
|
|||||||
|
|
||||||
// move available globaly to main tab
|
// move available globaly to main tab
|
||||||
$fields->removeByName('AvailableGlobally');
|
$fields->removeByName('AvailableGlobally');
|
||||||
|
|
||||||
$tab = $fields->findOrMakeTab('Root.Main');
|
$tab = $fields->findOrMakeTab('Root.Main');
|
||||||
$tab->push(CheckboxField::create('AvailableGlobally'));
|
$tab->push(CheckboxField::create('AvailableGlobally'));
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class ElementRows extends DataExtension
|
|||||||
|
|
||||||
$object = $object ? $object : $this->owner;
|
$object = $object ? $object : $this->owner;
|
||||||
|
|
||||||
if(!$object->isRoot()){
|
if (!$object->isRoot()) {
|
||||||
$size = $object->getField('Size');
|
$size = $object->getField('Size');
|
||||||
$max = $size ? $max / (self::colsNumber() / $size) : $max;
|
$max = $size ? $max / (self::colsNumber() / $size) : $max;
|
||||||
$parent = $object->Parent()->getOwnerPage();
|
$parent = $object->Parent()->getOwnerPage();
|
||||||
@ -185,8 +185,8 @@ class ElementRows extends DataExtension
|
|||||||
{
|
{
|
||||||
$db = Config::inst()->get(self::class, 'db');
|
$db = Config::inst()->get(self::class, 'db');
|
||||||
$sizes = $db['Size'];
|
$sizes = $db['Size'];
|
||||||
$sizes = preg_replace('!Enum\("([0-9,]+)","([0-9]+)"\)!i','$1', $sizes);
|
$sizes = preg_replace('!Enum\("([0-9,]+)","([0-9]+)"\)!i', '$1', $sizes);
|
||||||
$sizes = explode(',',$sizes);
|
$sizes = explode(',', $sizes);
|
||||||
|
|
||||||
return max($sizes);
|
return max($sizes);
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ class ElementRows extends DataExtension
|
|||||||
$container_styles = array_keys(self::$container_styles);
|
$container_styles = array_keys(self::$container_styles);
|
||||||
|
|
||||||
if (!$type && $this->isRoot()) {
|
if (!$type && $this->isRoot()) {
|
||||||
$type = $container_styles[0];
|
$type = \Page::DefaultContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type;
|
return $type;
|
||||||
|
@ -9,6 +9,13 @@ use DNADesign\Elemental\Models\ElementContent;
|
|||||||
|
|
||||||
class Page extends SiteTree
|
class Page extends SiteTree
|
||||||
{
|
{
|
||||||
|
private static $default_container_class = 'container';
|
||||||
|
|
||||||
|
public static function DefaultContainer()
|
||||||
|
{
|
||||||
|
return self::config()->get('default_container_class');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shows custom summary of the post, otherwise
|
* Shows custom summary of the post, otherwise
|
||||||
* Displays summary of the first content element
|
* Displays summary of the first content element
|
||||||
|
Loading…
Reference in New Issue
Block a user