Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
php
php
<?php

namespace Apps\TodoList\Controller;

class AddController extends \Phpfox_Component
{
     public function process()
    {
        // Get phpFox core template service
        $template = $this->template();

        // set view title
        $template->setTitle(_p('Add To Do'));

        // set view breadcrumb
        $template->setBreadCrumb(_p('Add To Do'),
            $this->url()->makeUrl('to-do-list/add'));

        // add your section menus
        $template->buildSectionMenu('to-do-list', [
            'Browse' => $this->url()->makeUrl('/to-do-list'),
            'Create' => $this->url()->makeUrl('/to-do-list/add'),
        ]);
    }
}

Look in to pasted code, you use _p function many times, what exactly _p does?

_p is a shortcut to call Translation translation service, which translate a phrase id
to the language which had been selected by current logged in user. _p gives a flexible, robust way allows developers/admins/translators to modify messages
translation on the fly.

...