Frontend\Core\Language\Language::getAction PHP Метод

getAction() публичный статический Метод

Get an action from the language-file
public static getAction ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
Результат string
    public static function getAction($key, $fallback = true)
    {
        // redefine
        $key = \SpoonFilter::toCamelCase((string) $key);
        // if the action exists return it,
        if (isset(self::$act[$key])) {
            return self::$act[$key];
        }
        // If we should fallback and the fallback label exists, return it
        if (isset(self::$fallbackAct[$key]) && $fallback === true && Model::getContainer()->getParameter('kernel.debug') === false) {
            return self::$fallbackAct[$key];
        }
        // otherwise return the key in label-format
        return '{$act' . $key . '}';
    }

Usage Example

Пример #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new FrontendForm('own_question', '#' . FL::getAction('OwnQuestion'));
     $this->frm->addText('name')->setAttributes(array('required' => null));
     $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email'));
     $this->frm->addTextarea('message')->setAttributes(array('required' => null));
 }
All Usage Examples Of Frontend\Core\Language\Language::getAction