From d582a08e4d0916a780a768c584158502d149ba5d Mon Sep 17 00:00:00 2001 From: Tony Air Date: Thu, 8 Jul 2021 15:53:26 +0200 Subject: [PATCH] IMPR: Element Icons --- src/Elements/AccordionElement.php | 1 + src/Elements/CustomSnippetElement.php | 1 + src/Elements/InstagramElement.php | 36 +++++++++++++-------------- src/Elements/TeamMembersElement.php | 4 ++- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/Elements/AccordionElement.php b/src/Elements/AccordionElement.php index 4516461..767e30a 100755 --- a/src/Elements/AccordionElement.php +++ b/src/Elements/AccordionElement.php @@ -12,6 +12,7 @@ use DNADesign\ElementalList\Model\ElementList; class AccordionElement extends ElementList { + private static $icon = 'font-icon-block-file-list'; private static $singular_name = 'Accordion Element'; private static $plural_name = 'Accordion Element'; diff --git a/src/Elements/CustomSnippetElement.php b/src/Elements/CustomSnippetElement.php index db81241..1c56e9c 100755 --- a/src/Elements/CustomSnippetElement.php +++ b/src/Elements/CustomSnippetElement.php @@ -15,6 +15,7 @@ use SilverStripe\Forms\TextareaField; class CustomSnippetElement extends ElementContent { + private static $icon = 'font-icon-external-link'; private static $singular_name = 'Custom Snippet'; private static $plural_name = 'Custom Snippets'; diff --git a/src/Elements/InstagramElement.php b/src/Elements/InstagramElement.php index 1aecbc2..2469399 100755 --- a/src/Elements/InstagramElement.php +++ b/src/Elements/InstagramElement.php @@ -8,12 +8,12 @@ namespace A2nt\ElementalBasics\Elements; - use DNADesign\Elemental\Models\BaseElement; use SilverStripe\Core\Convert; class InstagramElement extends BaseElement { + private static $icon = 'font-icon-menu-files'; private static $singular_name = 'Instagram'; private static $plural_name = 'Instagram Elements'; @@ -24,15 +24,15 @@ class InstagramElement extends BaseElement private static $db = [ 'Username' => 'Varchar(255)', - 'Tag' => 'Varchar(255)', - 'DisplayProfile' => 'Boolean(0)', - 'DisplayBiography' => 'Boolean(0)', - 'DisplayGallery' => 'Boolean(0)', - 'DisplayCaptions' => 'Boolean(0)', + 'Tag' => 'Varchar(255)', + 'DisplayProfile' => 'Boolean(0)', + 'DisplayBiography' => 'Boolean(0)', + 'DisplayGallery' => 'Boolean(0)', + 'DisplayCaptions' => 'Boolean(0)', ]; private static $defaults = [ - 'DisplayGallery' => true, + 'DisplayGallery' => true, ]; public function getType() @@ -45,14 +45,14 @@ class InstagramElement extends BaseElement */ public function getAttributes(): array { - return [ - 'data-username' => $this->Username, - 'data-display-profile' => $this->DisplayProfile, - 'data-display-biography' => $this->DisplayBiography, - 'data-display-gallery' => $this->DisplayGallery, - 'data-display-captions' => $this->DisplayCaptions, - 'data-items' => 12, - ]; + return [ + 'data-username' => $this->Username, + 'data-display-profile' => $this->DisplayProfile, + 'data-display-biography' => $this->DisplayBiography, + 'data-display-gallery' => $this->DisplayGallery, + 'data-display-captions' => $this->DisplayCaptions, + 'data-items' => 12, + ]; } /** * Custom attributes to process. @@ -63,7 +63,7 @@ class InstagramElement extends BaseElement */ public function AttributesHTML($attributes = null): string { - if (!$attributes) { + if (!$attributes) { $attributes = $this->getAttributes(); } @@ -93,11 +93,11 @@ class InstagramElement extends BaseElement public function FeedLink() { - return 'https://www.instagram.com/'.($this->Username ? $this->Username : 'explore/tags/'.$this->Tag).'/'; + return 'https://www.instagram.com/'.($this->Username ? $this->Username : 'explore/tags/'.$this->Tag).'/'; } public function FeedTitle() { - return ($this->Username ? '@'.$this->Username : '#'.$this->Tag); + return ($this->Username ? '@'.$this->Username : '#'.$this->Tag); } } diff --git a/src/Elements/TeamMembersElement.php b/src/Elements/TeamMembersElement.php index 574f1ba..3a478a5 100755 --- a/src/Elements/TeamMembersElement.php +++ b/src/Elements/TeamMembersElement.php @@ -7,11 +7,13 @@ */ namespace A2nt\ElementalBasics\Elements; + use DNADesign\Elemental\Models\BaseElement; use A2nt\ElementalBasics\Models\TeamMember; class TeamMembersElement extends BaseElement { + private static $icon = 'font-icon-menu-security'; private static $singular_name = 'Team Members'; private static $plural_name = 'Team Members'; @@ -25,6 +27,6 @@ class TeamMembersElement extends BaseElement public function Members() { - return TeamMember::get()->sort('RAND()'); + return TeamMember::get(); } }