Skip to content

Commit

Permalink
Change SGML to XML
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed May 22, 2022
1 parent eafda36 commit 3038f16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions about.page
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
---
title: Alert
description: Display alert messages throughout the page.
description: Display alert messages once.
icon: 'M7,2V13H10V22L17,10H13L17,2H7Z'
author: Taufik Nurrohman
type: Markdown
version: 2.0.0
...

All method names except `get`, `let`, and `set` can be used. This class makes use of the `__callStatic()` method to generate dynamic types. Each method declares the alert type. The most common and recommended method names are `error`, `info`, and `success`, which can be used to represent [three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic) (`error` as `false`, `info` as `null`, and `success` as `true`).
All methods except `get`, `let`, and `set` can be used. This class uses `__callStatic` method to generate dynamic types. Each given method will declare the alert type. The most common and recommended method names are `error`, `info`, and `success`, which can be used to represent [three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic) (`error` as `false`, `info` as `null`, and `success` as `true`).

~~~ .php
Alert::error('This is an error message.');
Alert::info('This is an info message.');
Alert::success('This is a success message.');
~~~

To display the alert block in your layout, add this line at a specific point in your layout file, for example under the form’s opening tag:
It is possible to add parameters to your message like this:

~~~ .php
Alert::error('Please fill out the %s field!', ['name']); // “Please fill out the name field!”
~~~

To display the alert block in your layout, add this line at a specific point in your layout file, for example, under the form’s opening tag:

~~~ .php
<?= self::alert(); ?>
~~~

The built-in alert block doesn’t care about the type. Every alert created will be passed as a `<p role="alert">…</p>` element in the HTML output. To generate unique alert block for each type, you need to make your own HTML output in a `.\lot\layout\alert.php` file:
The built-in alert block doesn’t care about the type. Every alert created will be passed as a `<p role="alert">…</p>` element in the HTML output. To generate unique alert block for each type, you need to make your own HTML output in a `.\lot\y\*\alert.php` file:

~~~ .php
<?php foreach (alert() as $v): ?>
Expand Down
2 changes: 1 addition & 1 deletion engine/kernel/alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __toString() {
if ($alert = self::get()) {
$out = "";
foreach ($alert as $v) {
$out .= new SGML($v);
$out .= new XML($v);
}
return $out;
}
Expand Down

0 comments on commit 3038f16

Please sign in to comment.