Giter Club home page Giter Club logo

kohana-notice's People

Contributors

loonies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kohana-notice's Issues

add array as message parameter in add function

Hi, thanks for this simple little module. it's very useful.
I would like to request to add array as message parameter in add function so you can pass array in message parameter.

This is useful when we want to render error from validation class (which resulting array)

for example

Notice::add(Notice::ERROR, $validate->errors('items'));

so the code need to updated to something like this

/**
 * Adds new notification message
 *
 * @param   string  Message type
 * @param   mixed   Message text or array of Message text
 * @param   array   Message variables
 * @param   array   Additional message items
 * @return  void
 */
public static function add($type, $message = NULL, array $variables = NULL, array $items = array())
{
    $session = Session::instance('native');

    $notifications = $session->get('notice', array());

    if (Arr::is_array($message))
    {
        foreach ($message as $value)
        {
            $notifications[$type][] = array(
                'message'   =>  __($value, $variables),
                'items'     =>  $items,
            );
        }
    }
    else
    {
        $notifications[$type][] = array(
            'message'   =>  __($message, $variables),
            'items'     =>  $items,
        );
    }

    $session->set('notice', $notifications);
}

Thank you

Session shouldn't force driver

In Notice Core, the session driver is forced to native.
This need to be changed to

$session = Session::instance();

The reason

  1. When developing using database session driver, we don't need to set native driver session cookie name.
  2. This should be controlled by user not by module.

Render does not work as expected

Why in earth render would return an array instead rendering the page.
Note: version 0.3 (3.2 branch)

I think version 0.2 does a great job

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.