Backend\Core\Language\Language::getInterfaceLanguages PHP Method

getInterfaceLanguages() public static method

Get all the possible interface languages
public static getInterfaceLanguages ( ) : array
return array
    public static function getInterfaceLanguages()
    {
        $languages = array();
        // grab the languages from the settings & loop language to reset the label
        foreach ((array) Model::get('fork.settings')->get('Core', 'interface_languages', array('en')) as $key) {
            // fetch language's translation
            $languages[$key] = self::getLabel(mb_strtoupper($key), 'Core');
        }
        // sort alphabetically
        asort($languages);
        // return languages
        return $languages;
    }

Usage Example

Esempio n. 1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('add');
     // get the groups
     $groups = BackendGroupsModel::getAll();
     // if there is only one group we can check it so the user isn't bothered with an error for not selecting one
     $checkedGroups = count($groups) == 1 ? $groups[0]['value'] : null;
     // create elements
     // profile
     $this->frm->addText('email', null, 255)->setAttribute('type', 'email');
     $this->frm->addPassword('password', null, 75, 'form-control passwordGenerator', 'form-control danger passwordGenerator')->setAttributes(array('autocomplete' => 'off'));
     $this->frm->addPassword('confirm_password', null, 75)->setAttributes(array('autocomplete' => 'off'));
     $this->frm->addText('name', null, 255);
     $this->frm->addText('surname', null, 255);
     $this->frm->addText('nickname', null, 24);
     $this->frm->addImage('avatar');
     $this->frm->addDropdown('interface_language', BL::getInterfaceLanguages(), $this->get('fork.settings')->get('Core', 'default_interface_language'));
     $this->frm->addDropdown('date_format', BackendUsersModel::getDateFormats(), BackendAuthentication::getUser()->getSetting('date_format'));
     $this->frm->addDropdown('time_format', BackendUsersModel::getTimeFormats(), BackendAuthentication::getUser()->getSetting('time_format'));
     $this->frm->addDropdown('number_format', BackendUsersModel::getNumberFormats(), BackendAuthentication::getUser()->getSetting('number_format', 'dot_nothing'));
     $this->frm->addDropdown('csv_split_character', BackendUsersModel::getCSVSplitCharacters());
     $this->frm->addDropdown('csv_line_ending', BackendUsersModel::getCSVLineEndings());
     // permissions
     $this->frm->addCheckbox('active', true);
     // @TODO remove this when the api is kicked out
     $this->frm->addCheckbox('api_access', false);
     $this->frm->addMultiCheckbox('groups', $groups, $checkedGroups);
 }
All Usage Examples Of Backend\Core\Language\Language::getInterfaceLanguages