Adds new view event system, add event to sign in form

This commit is contained in:
Samuel Georges 2015-08-28 04:31:41 +10:00
parent b39837834b
commit 7f502768dc
2 changed files with 21 additions and 2 deletions

View File

@ -26,6 +26,7 @@
autocomplete="off" autocomplete="off"
maxlength="255" /> maxlength="255" />
<!-- Submit Login -->
<button type="submit" class="btn btn-primary login-button"> <button type="submit" class="btn btn-primary login-button">
<?= e(trans('backend::lang.account.login')) ?> <?= e(trans('backend::lang.account.login')) ?>
</button> </button>
@ -38,6 +39,7 @@
</a> </a>
</p> </p>
<!-- Submit Login -->
</div> </div>
<?= Form::close() ?> <?= Form::close() ?>
<?= $this->fireViewEvent('backend.auth.extendSigninView') ?>

View File

@ -2,6 +2,7 @@
use File; use File;
use Lang; use Lang;
use Event;
use Block; use Block;
use SystemException; use SystemException;
@ -233,4 +234,20 @@ trait ViewMaker
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null; $guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return ($isPublic) ? File::localToPublic($guessedPath) : $guessedPath; return ($isPublic) ? File::localToPublic($guessedPath) : $guessedPath;
} }
/**
* Special event function used for extending within view files
* @param string $event Event name
* @param array $params Event parameters
* @return string
*/
public function fireViewEvent($event, $params = [])
{
// Add the local object to the first parameter always
array_unshift($params, $this);
if ($result = Event::fire($event, $params)) {
return implode(PHP_EOL.PHP_EOL, (array) $result);
}
}
} }