mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-24 17:52:41 +01:00
Render fields only if visible
This commit is contained in:
parent
15a64d38b8
commit
c1281bafc6
@ -163,7 +163,9 @@ abstract class AbstractController
|
||||
*/
|
||||
protected function field(Field $field, $render = true)
|
||||
{
|
||||
return $this->view('fields.' . $field->type(), array('field' => $field), $render);
|
||||
if ($field->isVisible()) {
|
||||
return $this->view('fields.' . $field->type(), array('field' => $field), $render);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,6 +105,16 @@ class Field extends DataSetter
|
||||
return $this->get('value', $this->get('default'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the field is visible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisible()
|
||||
{
|
||||
return $this->get('visible', true) === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import data helper
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user