* zin: add label.
This commit is contained in:
@@ -26,3 +26,4 @@ function center() {return createWg('center', func_get_args());}
|
||||
function cell() {return createWg('cell', func_get_args());}
|
||||
function actionItem() {return createWg('actionitem', func_get_args());}
|
||||
function nav() {return createWg('nav', func_get_args());}
|
||||
function label() {return createWg('label', func_get_args());}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace zin;
|
||||
|
||||
class label extends wg
|
||||
{
|
||||
static $defineProps = 'text';
|
||||
|
||||
public function onAddChild($child)
|
||||
{
|
||||
if(is_string($child) && !$this->props->has('text'))
|
||||
{
|
||||
$this->props->set('text', $child);
|
||||
return false;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return span(
|
||||
$this->prop('text'),
|
||||
setClass(array(
|
||||
'label',
|
||||
$this->props->class->toStr(),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user