mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
IMPROVEMENT: widgets areas
This commit is contained in:
parent
cbf386f9a3
commit
fdebf4abef
@ -60,6 +60,8 @@ SilverStripe\Blog\Model\BlogPost:
|
||||
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
icon: '<i class="icon font-icon-p-document"></i>'
|
||||
extensions:
|
||||
- Site\Widgets\WidgetExtension
|
||||
SilverStripe\Blog\Widgets\BlogArchiveWidget:
|
||||
icon: '<i class="icon font-icon-p-archive"></i>'
|
||||
SilverStripe\Blog\Widgets\BlogCategoriesWidget:
|
||||
|
@ -21,10 +21,6 @@ class BannerWidget extends Widget
|
||||
private static $icon = '<i class="icon font-icon-block-banner"></i>';
|
||||
private static $table_name = 'BannerWidget';
|
||||
|
||||
private static $db = [
|
||||
'Title' => 'Varchar(255)',
|
||||
];
|
||||
|
||||
private static $has_one = [
|
||||
'Image' => Image::class,
|
||||
'Link' => Link::class,
|
||||
|
28
app/src/Widgets/WidgetExtension.php
Normal file
28
app/src/Widgets/WidgetExtension.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Site\Widgets;
|
||||
|
||||
|
||||
use DNADesign\Elemental\Forms\TextCheckboxGroupField;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
|
||||
class WidgetExtension extends DataExtension
|
||||
{
|
||||
private static $db = [
|
||||
'ShowTitle' => 'Boolean(1)',
|
||||
];
|
||||
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
{
|
||||
parent::updateCMSFields($fields);
|
||||
// Add a combined field for "Title" and "Displayed" checkbox in a Bootstrap input group
|
||||
$fields->removeByName('ShowTitle');
|
||||
$fields->replaceField(
|
||||
'Title',
|
||||
TextCheckboxGroupField::create()
|
||||
->setName('Title')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<div class="page-content">
|
||||
<h1 class="page-header $DefaultContainer<% if $ElementalArea.Elements.Count < 1 %> no-elements<% end_if %>">$Title</h1>
|
||||
<h1 class="element page-header $DefaultContainer<% if $ElementalArea.Elements.Count < 1 %> no-elements<% end_if %>">
|
||||
$Title
|
||||
</h1>
|
||||
|
||||
<div class="page-content">
|
||||
<% if $CurrentElement %>
|
||||
|
@ -27,7 +27,7 @@
|
||||
$Layout
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="page-content">
|
||||
<div class="sidebar page-content">
|
||||
$SideBarView
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<nav class="secondary element">
|
||||
<% if $Title %><h2 class="widget-title">$Title</h2><% end_if %>
|
||||
<nav class="secondary element $ClassName">
|
||||
<% if $ShowTitle && $Title %><h2 class="widget-title">$Title</h2><% end_if %>
|
||||
$Content
|
||||
</nav>
|
||||
|
Loading…
Reference in New Issue
Block a user