mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Hide extra vars with no value #2486
This commit is contained in:
parent
7d6565766a
commit
4bf4aca762
4 changed files with 24 additions and 4 deletions
|
|
@ -22,8 +22,10 @@
|
|||
{@ $_extra_vars = $oDocument->getExtraVars(); }
|
||||
<dl class="xv">
|
||||
<!--@foreach($_extra_vars as $key => $val)-->
|
||||
<dt>{$val->name}</dt>
|
||||
<dd>{$val->getValueHTML()}</dd>
|
||||
<!--@if($val->hasValue())-->
|
||||
<dt>{$val->name}</dt>
|
||||
<dd>{$val->getValueHTML()}</dd>
|
||||
<!--@end-->
|
||||
<!--@end-->
|
||||
</dl>
|
||||
<!--@end-->
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<!-- Extra Output -->
|
||||
<div class="exOut" cond="$oDocument->isExtraVarsExists() && $oDocument->isAccessible()">
|
||||
<table border="1" cellspacing="0" summary="Extra Form Output">
|
||||
<tr loop="$oDocument->getExtraVars() => $key,$val">
|
||||
<tr loop="$oDocument->getExtraVars() => $key,$val" cond="$val->hasValue()">
|
||||
<th scope="row">{$val->name}</th>
|
||||
<td>{$val->getValueHTML()} </td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<!-- Extra Output -->
|
||||
<div class="exOut" cond="$oDocument->isExtraVarsExists() && $oDocument->isAccessible()">
|
||||
<table border="1" cellspacing="0" summary="Extra Form Output">
|
||||
<tr loop="$oDocument->getExtraVars() => $key,$val">
|
||||
<tr loop="$oDocument->getExtraVars() => $key,$val" cond="$val->hasValue()">
|
||||
<th scope="row">{$val->name}</th>
|
||||
<td>{$val->getValueHTML()} </td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -121,6 +121,24 @@ class Value
|
|||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this extra variable has a value.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasValue(): bool
|
||||
{
|
||||
$value = self::_getTypeValue($this->type, $this->value);
|
||||
if ($value === null || $value === '' || (is_array($value) && !count($value)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw value.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue