-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
886dd4d
commit 5116495
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
namespace sgroup\sitemodule\fieldlayoutelements; | ||
|
||
use Craft; | ||
use craft\base\ElementInterface; | ||
use craft\fieldlayoutelements\BaseUiElement; | ||
use craft\helpers\Cp; | ||
use craft\helpers\Html; | ||
|
||
class Note extends BaseUiElement | ||
{ | ||
// Properties | ||
// ========================================================================= | ||
|
||
public $note; | ||
|
||
|
||
// Protected Methods | ||
// ========================================================================= | ||
|
||
protected function selectorLabel(): string | ||
{ | ||
return $this->note ?: Craft::t('app', 'Note'); | ||
} | ||
|
||
protected function selectorIcon() | ||
{ | ||
return '@appicons/hash.svg'; | ||
} | ||
|
||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
public function settingsHtml() | ||
{ | ||
return Cp::textFieldHtml([ | ||
'label' => Craft::t('app', 'Note'), | ||
'id' => 'note', | ||
'name' => 'note', | ||
'value' => $this->note, | ||
]); | ||
} | ||
|
||
public function formHtml(ElementInterface $element = null, bool $static = false) | ||
{ | ||
return Html::tag('p', Html::encode(Craft::t('site', $this->note))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
namespace sgroup\sitemodule\fieldlayoutelements; | ||
|
||
use Craft; | ||
use craft\base\ElementInterface; | ||
use craft\fieldlayoutelements\BaseUiElement; | ||
use craft\helpers\Cp; | ||
use craft\helpers\Html; | ||
|
||
class Spacer extends BaseUiElement | ||
{ | ||
// Protected Methods | ||
// ========================================================================= | ||
|
||
protected function selectorLabel(): string | ||
{ | ||
return Craft::t('app', 'Spacer'); | ||
} | ||
|
||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
public function settingsHtml() | ||
{ | ||
return Cp::textFieldHtml([ | ||
'label' => Craft::t('app', 'Spacer'), | ||
'id' => 'spacer', | ||
'name' => 'spacer', | ||
]); | ||
} | ||
|
||
public function formHtml(ElementInterface $element = null, bool $static = false) | ||
{ | ||
return ''; | ||
} | ||
} |