Skip to content

fanningert/kirbycms-extension-webhelper

Repository files navigation

Kirby Extension - WebHelper

A collection of little helper for usage in Kirby

Installation

KirbyCli

kirby plugin:install fanningert/kirbycms-extension-webhelper

GIT

Go into the {kirby_installation}/site/plugins directory and execute following command.

$ git clone https://github.com/fanningert/kirbycms-extension-webhelper.git

GIT submodule

Go in the root directory of your git repository and execute following command to add the repository as submodule to your GIT repository.

$ git submodule add https://github.com/fanningert/kirbycms-extension-webhelper.git ./site/plugins/kirbycms-extension-webhelper
$ git submodule init
$ git submodule update

Manuell

Update

KirbyCli

kirby plugin:update fanningert/kirbycms-extension-webhelper

GIT

Go into the {kirby_installation}/site/plugins/kirbycms-extension-webhelper directory and execute following command.

$ git pull

GIT submodule

Go in the root directory of your git repository and execute following command to update the submodule of this extension.

$ git submodule update

TODO

  • All function: Add config parameter to selectiv activate a function (KirbyTag)
  • Function age: Add optional Attributes for dateformat and timezone
  • Function messagebox: Add config parameter to define the the prefix for class (Default: alert)

Content

Messages boxes

Generel the tags works in two versions.

Simple tag

(message_type: text)

Complex tag

(message_type)
text
(/message_type)

Information messages

Kirby
(info: This is an important information.)
PHP
$text = "This is an important information.";
at\fanninger\kirby\extension\webhelper\WebHelper::messageboxInformation( $text );
Output
<div class="alert alert-info">This is an important information.</div>

Success messages

Kirby
(success: Hooooray! This messages says that operation succeeded!!)
PHP
$text = "Hooooray! This messages says that operation succeeded!!";
at\fanninger\kirby\extension\webhelper\WebHelper::messageboxSuccess( $text );
Output
<div class="alert alert-success">Hooooray! This messages says that operation succeeded!!</div>

Warning messages

Kirby
(warning: Now this is a warning! One more click and you`ll face the consequences!)
PHP
$text = "Now this is a warning! One more click and you`ll face the consequences!";
at\fanninger\kirby\extension\webhelper\WebHelper::messageboxWarning( $text );
Output
<div class="alert alert-warning">Now this is a warning! One more click and you`ll face the consequences!</div>

Error messages

Kirby
(error: Oooops, this is an error message. You know what that means.)
PHP
$text = "Oooops, this is an error message. You know what that means.";
at\fanninger\kirby\extension\webhelper\WebHelper::messageboxError( $text );
Output
<div class="alert alert-error">Oooops, this is an error message. You know what that means.</div>

Validation messages

Kirby
(validation: First name is a required field)
PHP
$text = "First name is a required field";
at\fanninger\kirby\extension\webhelper\WebHelper::messageboxValidation( $text );
Output
<div class="alert alert-validation">First name is a required field</div>

Figure

Simple example

(figure caption: text)
content
(/figure)

Output

<figure>
  content
  <figcaption>text</figcaption>
</figure>

Caption top

(figure: text caption_top: true class: test-class)
content
(/figure)

Output

<figure class="test-class">
  <figcaption>text</figcaption>
  content
</figure>

Calulcate age

Kirby
(age: 21/01/1972)
PHP
$dayOfBirth = '21/01/1972';
$dateFormat = 'd/m/Y';         //Optional
$timezone = 'Europe/Brussels'; //Optional
at\fanninger\kirby\extension\webhelper\WebHelper::calcAge($dayOfBirth, $dateFormat, $timezone);

About

A collection of little helper for usage in Kirby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages