2017 © Pedro Peláez
 

library ext-view-helper

MvcCore Extension - View Helper - abstract class code and interface support code to create more sofisticated view helpers with better setup and protected properties.

image

mvccore/ext-view-helper

MvcCore Extension - View Helper - abstract class code and interface support code to create more sofisticated view helpers with better setup and protected properties.

  • Monday, June 4, 2018
  • by tomFlidr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

MvcCore - Extension - View - Helper

Latest Stable Version License PHP Version, (*1)

Abstract class code and interface support code to create more sofisticated view helpers with better setup and protected properties., (*2)

Installation

composer require mvccore/ext-view-helper

Example

Your custom primitive view helper code:, (*3)

// located in `/App/Views/Helpers/FormatNumber.php`

namespace App\Views\Helpers;

class FormatNumber {
    public function FormatNumber ($number) { // $number = 1234.56;
        return number_format($number); // english notation - 1,234
    }
}

... could be more sofisticated with this package:, (*4)

// located in `/App/Views/Helpers/FormatNumber.php`

namespace App\Views\Helpers;

class FormatNumber extends \MvcCore\Ext\Views\Helpers\AbstractHelper
    public function FormatNumber ($number) { // $number = 1234.56;
        if ($this->request->GetLang() == 'fr') {
            return number_format($number, 2, ',', ' '); // french notation: 1 234,56
        } else {
            return number_format($number); // english notation: 1,234
        }
    }
}

Automaticly assigned protected properties

  • AbstractHelper::$view as \MvcCore\View|\MvcCore\IView
  • AbstractHelper::$controller as \MvcCore\Controller|\MvcCore\IController
  • AbstractHelper::$request as \MvcCore\Request|\MvcCore\IRequest
  • AbstractHelper::$response as \MvcCore\Response|\MvcCore\IResponse

Behaviour

  • Your view helper will be created by static method GetInstance() as singleton with abstract class AbstractHelper.
  • Everytime, when there will be rendered different view script (action view, layout view or sub-controller view), there will be called automatically method AbstractHelper::SetView($view); to setup view object or other objects inside helper to actual ones.

The Versions

04/06 2018

dev-master

9999999-dev

MvcCore Extension - View Helper - abstract class code and interface support code to create more sofisticated view helpers with better setup and protected properties.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin framework extension helper mvc abstract support view interface plug-in viewhelper ext mvccore

10/05 2018

v5.0.0-alpha

5.0.0.0-alpha

MvcCore Extension - View Helper - abstract class code and interface support code to create more sofisticated view helpers with better setup and protected properties.

  Sources   Download

BSD-3-Clause

The Requires

 

plugin framework extension helper mvc abstract support view interface plug-in viewhelper ext mvccore