2017 © Pedro Peláez
 

library component-controller

Controller component for WordPress

image

flexpress/component-controller

Controller component for WordPress

  • Wednesday, October 8, 2014
  • by timperry
  • Repository
  • 1 Watchers
  • 0 Stars
  • 77 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

FlexPress controller component

Build Status, (*1)

Install with Pimple

  • This example creates a page controller, you must pass it the DIC.
$pimple["pageController"] = function ($c) {
  return new PageController($c);
};

Implementing the concreate class

  • Create a class that implements the AbstractController class
  • You have to implement the indexAction method, which takes a $request object, this is a Symfony 2Request component object.
class PageController extends AbstractController {

    public function indexAction($request)
    {

        echo "This is the index action for the PageController";

    }

}

You can also extend the AbstractTimberController which adds the render method that uses Timber/Twig to render the given template with the context., (*2)

class PageController extends AbstractTimberController {

    public function indexAction($request)
    {

        $context = \Timber::get_context();
        $this->render('page.twig', $context);

    }

}

Finally you will want to use the DIC on the controller to access various data and services, you can do this via the dic property of the controller:, (*3)

public function indexAction($request)
{

    $context = \Timber::get_context();
    $context["searchManager"] = $this->dic["searchManager"];

    $this->render('page.twig', $context);

}

The Versions

08/10 2014

dev-master

9999999-dev

Controller component for WordPress

  Sources   Download

The Development Requires

13/08 2014

v1.0.0

1.0.0.0

Controller component for WordPress

  Sources   Download