2017 © Pedro Peláez
 

library widgets

Widgets component for Phalcon.

image

phalcon-ext/widgets

Widgets component for Phalcon.

  • Thursday, August 6, 2015
  • by KorsaR-ZN
  • Repository
  • 1 Watchers
  • 5 Stars
  • 2,913 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

Phalcon\Ext\Widgets

Installing

Install composer in a common location or in your project:, (*1)

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:, (*2)

{
    "require": {
        "phalcon-ext/widgets": "dev-master"
    }
}

Run the composer installer:, (*3)

php composer.phar install

Add in your the code, (*4)

require_once('vendor/autoload.php');

Using

class SomeWidget extends Phalcon\Ext\Widgets\WidgetBase
{
  public function init()
  {
    // optional some method
  }

  public function render($params = null) 
  {
    return $params['a'] + $params['b'] * ($params['c'] ?: 1);
  }
}

// Register widgets manager in DI
$di->setShared('widgets', function() use ($di) {

  $widgets = new Phalcon\Ext\Widgets\Manager();

  // Register some widget (the syntax is similar in DI)
  $widgets->set('some', function($options) {
    $widget = SomeWidget($options);
    $widget->init();

    return $widget;
  });

  return $widgets;
});


/**
 * Somewhere in view
 */

$options = []; // Optional parameter, It will be passed to the constructor of the widget before creating

echo $this->getDI()->get('widgets')->render('some', ['a' => 5, 'b' => 5, 'c' => 2], $options); // 15

The Versions

06/08 2015

dev-master

9999999-dev

Widgets component for Phalcon.

  Sources   Download

LGPL

The Requires

  • php >=5.4.0

 

by Stanislav Kiryukhin

widget widgets phalcon phalcon-ext

04/11 2014

v0.2.0

0.2.0.0

Widgets component for Phalcon.

  Sources   Download

LGPL

The Requires

  • php >=5.4.0

 

by Stanislav Kiryukhin

widget widgets phalcon phalcon-ext

19/10 2014

v0.1.0

0.1.0.0

Widgets component for Phalcon.

  Sources   Download

LGPL

The Requires

  • php >=5.4.0

 

by Stanislav Kiryukhin

widget widgets phalcon phalcon-ext