Allow passing explicit content to hints

This commit is contained in:
Samuel Georges 2015-07-25 09:34:47 +10:00
parent c4c11cf2f0
commit 48b4a137fa
2 changed files with 8 additions and 2 deletions

View File

@ -592,7 +592,8 @@ class Controller extends Extendable
/**
* Renders a hint partial, used for displaying informative information that
* can be hidden by the user.
* can be hidden by the user. If you don't want to render a partial, you can
* supply content via the 'content' key of $params.
* @param string $name Unique key name
* @param string $partial Reference to content (partial name)
* @param array $params Extra parameters
@ -612,6 +613,7 @@ class Controller extends Extendable
return $this->makeLayoutPartial('hint', [
'hintName' => $name,
'hintPartial' => $partial,
'hintContent' => array_get($params, 'content'),
'hintParams' => $params
] + $params);
}

View File

@ -25,7 +25,11 @@
</div>
<?php endif ?>
<div class="content">
<?= $this->makePartial($hintPartial, $hintParams) ?>
<?php if ($hintContent): ?>
<?= $hintContent ?>
<?php else: ?>
<?= $this->makePartial($hintPartial, $hintParams) ?>
<?php endif ?>
</div>
</div>
<?php endif ?>