-
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.
Added HTML element and added in segments
Segments allow you to partitan the process of groups of elements
- Loading branch information
Luke Snowden
committed
Jan 31, 2019
1 parent
3539ee6
commit 2740346
Showing
10 changed files
with
222 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Laraview\Libs\Elements; | ||
|
||
use Laraview\Console\Commands\LaraviewGenerateElement; | ||
use Laraview\Libs\BaseElement; | ||
use Laraview\Libs\Blueprints\ElementBlueprint; | ||
use Laraview\Libs\Elements\Generate\InputGeneration; | ||
use Laraview\Libs\Elements\Traits\Formats\HtmlBootstrap; | ||
|
||
abstract class Html extends BaseElement implements ElementBlueprint | ||
{ | ||
|
||
use HtmlBootstrap; | ||
|
||
/** | ||
* Label text | ||
* @var string | ||
*/ | ||
protected $label = ''; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function render() | ||
{ | ||
$this->preRender(); | ||
return $this->wrapper( | ||
$this->label( $this->label, $this->attributes[ 'id' ] ) . | ||
$this->element() | ||
); | ||
} | ||
|
||
/** | ||
* @return mixed|null|string | ||
*/ | ||
public static function humanReadableName() | ||
{ | ||
return 'HTML Element'; | ||
} | ||
|
||
/** | ||
* @param $region | ||
* @param LaraviewGenerateElement $console | ||
* @return mixed | ||
*/ | ||
public static function generate( $region, LaraviewGenerateElement $console ) | ||
{ | ||
$generator = new InputGeneration( $region, $console ); | ||
$generator->setStubPath( __DIR__ . '/../../../stubs/elements/html.stub' ); | ||
return $generator->create(); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function value() {} | ||
|
||
/** | ||
* @param $model | ||
* @param $request | ||
*/ | ||
public function receivePayload( $model, $request ) {} | ||
|
||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace Laraview\Libs\Elements\Traits\Formats; | ||
|
||
trait HtmlBootstrap | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function preRender() | ||
{ | ||
parent::preRender(); | ||
$this->attributes[ 'class' ] = trim( ( isset( $this->attributes[ 'class' ] ) ? $this->attributes[ 'class' ] : '' ) . ' form-control' ); | ||
} | ||
|
||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace [NAMESPACE]; | ||
|
||
use Laraview\Libs\Blueprints\ElementBlueprint; | ||
use Laraview\Libs\Elements\Html; | ||
|
||
class [CLASS_NAME] extends Html implements ElementBlueprint | ||
{ | ||
|
||
/** | ||
* Name of input | ||
* @var string | ||
*/ | ||
protected $name = '[NAME]'; | ||
|
||
/** | ||
* Label text | ||
* @var string | ||
*/ | ||
protected $label = '[LABEL]'; | ||
|
||
/** | ||
* HTMl | ||
*/ | ||
protected function element() | ||
{ | ||
return '<p></p>'; | ||
} | ||
|
||
} |