42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
Crispage CMS
|
||
|
crispycat <the@crispy.cat>
|
||
|
https://crispy.cat/software/crispage
|
||
|
|
||
|
Crispage is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
*/
|
||
|
|
||
|
namespace Crispage\Components;
|
||
|
|
||
|
defined("ROOT") or die();
|
||
|
|
||
|
class MessagesComponent extends \Crispage\Response\Component {
|
||
|
public static function getExtensionInfo(): array {
|
||
|
return [
|
||
|
"id" => "crispage.components.messages",
|
||
|
"version" => VERSION
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function __construct(\Crispage $app, array $data) {
|
||
|
parent::__construct($app, $data);
|
||
|
}
|
||
|
|
||
|
public function render(): void {
|
||
|
?>
|
||
|
<div id="messages">
|
||
|
<?php foreach ($this->app->page->data["messages"] as $id => $msg) { ?>
|
||
|
<div id="msg_<?php echo $id; ?>" class="notification is-<?php echo $msg["color"]; ?> mb-2">
|
||
|
<?php echo $msg["content"]; ?>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
<?php
|
||
|
}
|
||
|
}
|
||
|
?>
|