PHP code example of axyr / silverstripe-flashmessage

1. Go to this page and download the library: Download axyr/silverstripe-flashmessage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

axyr / silverstripe-flashmessage example snippets


    public function submitForm($data, Form $form)
    {
        $form->saveInto($this->record);
        $this->record->write();
    
        Flash::success('Form saved');
    
        return $this->controller->redirect($this->controller->Link());
    }

Flash::info('Some message');
Flash::success('Some message');
Flash::warning('Some message');
Flash::danger('Some message'); // Bootstrap
Flash::alert('Some message'); // Foundation

Flash::success('You cannot close me', false);
Flash::success('I will fade out', false, true);

Flash::modal('Some message');