Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

Commit b81ddb3

Browse files
authored
change: use extension (#1)
* change: use extension * change: use new base version
1 parent 01b230d commit b81ddb3

File tree

5 files changed

+37
-55
lines changed

5 files changed

+37
-55
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"gorriecoe/silverstripe-link": "^1",
1717
"gorriecoe/silverstripe-linkfield": "^1",
1818
"unclecheese/display-logic": "^2",
19-
"syntro/silverstripe-elemental-bootstrap-baseitems": "^0.1",
19+
"syntro/silverstripe-elemental-bootstrap-baseitems": "^0.2",
2020
"syntro/silverstripe-elemental-icons": "^1"
2121
},
2222
"require-dev": {

src/Elements/AlertSection.php

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
use BucklesHusky\FontAwesomeIconPicker\Forms\FAPickerField;
1212
use gorriecoe\Link\Models\Link;
1313
use gorriecoe\LinkField\LinkField;
14-
use Syntro\SilverStripeElementalBaseitems\Elements\BootstrapSectionBaseElement;
1514

1615
/**
1716
* Bootstrap based alert section
1817
*
1918
* @author Matthias Leutenegger <hello@syntro.ch>
2019
*/
21-
class AlertSection extends BootstrapSectionBaseElement
20+
class AlertSection extends BaseElement
2221
{
2322
/**
2423
* This defines the block name in the CSS
@@ -43,6 +42,10 @@ class AlertSection extends BootstrapSectionBaseElement
4342
*/
4443
private static $table_name = 'ElementAlertSection';
4544

45+
/**
46+
* @var string
47+
*/
48+
private static $controller_template = 'AlertSectionHolder';
4649

4750
/**
4851
* if set to false, no Icons will be displayed
@@ -86,7 +89,7 @@ class AlertSection extends BootstrapSectionBaseElement
8689
*/
8790
private static $text_colors_by_background = [
8891
'danger' => 'light',
89-
'warning' => 'light',
92+
'warning' => 'dark',
9093
'success' => 'light',
9194
'primary' => 'light',
9295
];
@@ -227,44 +230,4 @@ public function getType()
227230
{
228231
return _t(__CLASS__ . '.BlockType', 'Alert Section');
229232
}
230-
231-
/**
232-
* ButtonHolder - helperfunction to allow template-replacement
233-
*
234-
* @return string
235-
*/
236-
public function ButtonHolder()
237-
{
238-
return $this->renderWith($this->getSubTemplate(__FUNCTION__));
239-
}
240-
241-
/**
242-
* ContentHolder - helperfunction to allow template-replacement
243-
*
244-
* @return string
245-
*/
246-
public function ContentHolder()
247-
{
248-
return $this->renderWith($this->getSubTemplate(__FUNCTION__));
249-
}
250-
251-
/**
252-
* HeaderHolder - helperfunction to allow template-replacement
253-
*
254-
* @return string
255-
*/
256-
public function HeaderHolder()
257-
{
258-
return $this->renderWith($this->getSubTemplate(__FUNCTION__));
259-
}
260-
261-
/**
262-
* IconHolder - helperfunction to allow template-replacement
263-
*
264-
* @return string
265-
*/
266-
public function IconHolder()
267-
{
268-
return $this->renderWith($this->getSubTemplate(__FUNCTION__));
269-
}
270233
}

templates/DNADesign/Elemental/Layout/SectionHolder.ss renamed to templates/DNADesign/Elemental/Layout/AlertSectionHolder.ss

File renamed without changes.

templates/Syntro/BootstrapElemental/Blocks/AlertSection.ss

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<section class="bg-$BackgroundColor text-$TextColor py-4">
2+
<div class="container text-center">
3+
<% if DisplayIcon && useIcons || ShowTitle %>
4+
<div class="mb-2 d-flex align-items-center justify-content-center text-left">
5+
<% if DisplayIcon && useIcons %>
6+
<span class="mr-3 mr-md-2" style="font-size:1.5em;">
7+
<i class="$FAIcon"></i>
8+
</span>
9+
<% end_if %>
10+
<% if ShowTitle %>
11+
<b>$Title</b>
12+
<% end_if %>
13+
</div>
14+
<% end_if %>
15+
<p class="m-0 text-justify text-md-center">
16+
$Content
17+
</p>
18+
<% if $Buttons %>
19+
<p class="mb-0 mt-2">
20+
<% loop Buttons %>
21+
<% if LinkURL %>
22+
<a {$IDAttr} class="mx-1 btn btn-sm btn-outline-$Up.LinkColor" href="{$LinkURL}"{$TargetAttr}>
23+
{$Title}
24+
</a>
25+
<% end_if %>
26+
<% end_loop %>
27+
</p>
28+
<% end_if %>
29+
</div>
30+
</section>

0 commit comments

Comments
 (0)