-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChoiceList // refactor internal structure to support "disabled"-attri…
…bute for checkbox, radio and options and allow in future to add more settings like "help"-text. View // complete refactor of markup to move away from <table> and be more flexible with styling elements. All elements on output will now have the "type" as modifier on the wrapper. Additionally the <label> and element itself will now also have a CSS class including the type. View/Button // introduce new "reset"- and "button"-types which will render a <button>
- Loading branch information
Showing
24 changed files
with
360 additions
and
97 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
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
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
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,37 @@ | ||
<?php declare(strict_types=1); # -*- coding: utf-8 -*- | ||
|
||
namespace ChriCo\Fields\View; | ||
|
||
use ChriCo\Fields\Element\ElementInterface; | ||
use ChriCo\Fields\Element\LabelAwareInterface; | ||
|
||
/** | ||
* Class Input | ||
* | ||
* @package ChriCo\Fields\View | ||
*/ | ||
class Button implements RenderableElementInterface | ||
{ | ||
use AttributeFormatterTrait; | ||
use AssertElementInstanceOfTrait; | ||
|
||
/** | ||
* @param ElementInterface|LabelAwareInterface $element | ||
* | ||
* @return string | ||
*/ | ||
public function render(ElementInterface $element): string | ||
{ | ||
// Every button should have a label (text). | ||
$this->assertElementIsInstanceOf($element, LabelAwareInterface::class); | ||
|
||
$attributes = $element->attributes(); | ||
$attributes = $this->buildCssClasses($attributes, 'element', $element); | ||
|
||
return sprintf( | ||
'<button %1$s>%2$s</button>', | ||
$this->attributesToString($attributes), | ||
$element->label(), | ||
); | ||
} | ||
} |
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
Oops, something went wrong.