Child pages
  • Create alias methods for getting language, theme, user, window [5.3.0-B1]
Skip to end of metadata
Go to start of metadata

There are 3 properties of the application, that used the most:

PropertyCode
current language
$this->Application->GetVar('m_lang');
current theme
$this->Application->GetVar('m_theme');
current user
$this->Application->RecallVar('user_id');
current window
$this->Application->GetVar('m_wid');

There are a few problems with current situation:

  • the typo error can be made during method argument typing (because it's a string, that isn't auto-completed by IDE) and therefore hard to catch bug can be made by accident
  • no way, with the help of IDE, to easily find all place, where particular property is being used (except of "Find in Files", which might get a false positives as well)

Proposing to create dedicated methods for accessing these specific properties.

Solution

  1. create "getCurrentLanguageId" method for getting current language
  2. create "getCurrentThemeId" method for getting current theme
  3. create "getCurrentUserId" method for getting current user
  4. create "getWindowID" method for getting current window
  5. replace code everywhere to use these new methods

Related Discussions

Related Tasks