* zin: add suffix block for entity label wg.
This commit is contained in:
@@ -1181,6 +1181,11 @@ function dashboard()
|
||||
* string title
|
||||
* string|array|null content
|
||||
* bool useHtml=false
|
||||
*
|
||||
* ====== blocks ======
|
||||
* subTitle => array()
|
||||
* actions => array()
|
||||
* ====================
|
||||
*/
|
||||
function section()
|
||||
{
|
||||
@@ -1193,6 +1198,10 @@ function section()
|
||||
* string|int|null entityID
|
||||
* string|int|null level
|
||||
* string text
|
||||
*
|
||||
* ====== blocks ======
|
||||
* suffix = array()
|
||||
* ====================
|
||||
*/
|
||||
function entityLabel()
|
||||
{
|
||||
|
||||
@@ -12,6 +12,10 @@ class entityLabel extends wg
|
||||
'text: string' // 实体文本
|
||||
);
|
||||
|
||||
protected static $defineBlocks = array(
|
||||
'suffix' => array()
|
||||
);
|
||||
|
||||
protected function onAddChild(mixed $child): mixed
|
||||
{
|
||||
if(is_string($child) && !$this->props->has('text'))
|
||||
@@ -47,14 +51,16 @@ class entityLabel extends wg
|
||||
|
||||
protected function build(): wg
|
||||
{
|
||||
$entityID = $this->buildEntityID();
|
||||
$suffix = $this->block('suffix');
|
||||
$entityID = $this->buildEntityID();
|
||||
$entityName = $this->buildEntityName();
|
||||
return div
|
||||
(
|
||||
setClass('entity-label', 'flex', 'items-center'),
|
||||
set($this->props->skip(array_keys(static::getDefinedProps()))),
|
||||
$entityID,
|
||||
$entityName
|
||||
$entityName,
|
||||
$suffix
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user