Backend\Modules\Locale\Engine\Model::getTypesForDropDown PHP Method

getTypesForDropDown() public static method

Get all locale types.
public static getTypesForDropDown ( ) : array
return array
    public static function getTypesForDropDown()
    {
        // fetch types
        $types = BackendModel::getContainer()->get('database')->getEnumValues('locale', 'type');
        // init
        $labels = $types;
        // loop and build labels
        foreach ($labels as &$row) {
            $row = \SpoonFilter::ucfirst(BL::msg(mb_strtoupper($row), 'Core'));
        }
        // build array
        return array_combine($types, $labels);
    }

Usage Example

Example #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     if ($this->getParameter('id') != null) {
         // get the translation
         $translation = BackendLocaleModel::get($this->getParameter('id', 'int'));
         // if not empty, set the filter
         if (!empty($translation)) {
             // we are copying the given translation
             $isCopy = true;
         } else {
             $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing' . $this->filterQuery);
         }
     } else {
         $isCopy = false;
     }
     // create form
     $this->frm = new BackendForm('add', BackendModel::createURLForAction() . $this->filterQuery);
     // create and add elements
     $this->frm->addDropdown('application', array('Backend' => 'Backend', 'Frontend' => 'Frontend'), $isCopy ? $translation['application'] : $this->filter['application']);
     $this->frm->addDropdown('module', BackendModel::getModulesForDropDown(), $isCopy ? $translation['module'] : $this->filter['module']);
     $this->frm->addDropdown('type', BackendLocaleModel::getTypesForDropDown(), $isCopy ? $translation['type'] : $this->filter['type'][0]);
     $this->frm->addText('name', $isCopy ? $translation['name'] : $this->filter['name']);
     $this->frm->addTextarea('value', $isCopy ? $translation['value'] : $this->filter['value'], null, null, true);
     $this->frm->addDropdown('language', BL::getWorkingLanguages(), $isCopy ? $translation['language'] : $this->filter['language'][0]);
 }
All Usage Examples Of Backend\Modules\Locale\Engine\Model::getTypesForDropDown