original_string: public static function getSlug($model)
      {
          $i18nModels = $model->i18n;
          $slugs = [];
          foreach ($i18nModels as $i18nModel) {
              if (empty($i18nModel->body)) continue; // skip languages for news without body
              $slugs[$i18nModel->lang_code] = $i18nModel->slug;
          }
  
          //$langs = array_keys(LangHelper::activeLanguages()); // better use as container-module's member:
          $module = Module::getModuleByClassname(Module::className());
          $langHelper = $module->langHelper;
          $langs = array_keys($langHelper::activeLanguages());
          $slug = '';
          foreach ($langs as $lang) {
              if (!empty($slugs[$lang])) {
                  $slug = $slugs[$lang];
                  break;
              }
          }
          if (strlen($slug) > static::$slugMaxLen) {
              $slug = substr($slug, 0, static::$slugMaxLen);
          }
          $slug = trim($slug, '-');
          return $slug;
      }
code: public static function getSlug($model)
      {
          $i18nModels = $model->i18n;
          $slugs = [];
          foreach ($i18nModels as $i18nModel) {
              if (empty($i18nModel->body)) continue; // skip languages for news without body
              $slugs[$i18nModel->lang_code] = $i18nModel->slug;
          }
  
          //$langs = array_keys(LangHelper::activeLanguages()); // better use as container-module's member:
          $module = Module::getModuleByClassname(Module::className());
          $langHelper = $module->langHelper;
          $langs = array_keys($langHelper::activeLanguages());
          $slug = '';
          foreach ($langs as $lang) {
              if (!empty($slugs[$lang])) {
                  $slug = $slugs[$lang];
                  break;
              }
          }
          if (strlen($slug) > static::$slugMaxLen) {
              $slug = substr($slug, 0, static::$slugMaxLen);
          }
          $slug = trim($slug, '-');
          return $slug;
      }
code_tokens: public static function getSlug ( $ model ) { $ i18nModels = $ model -> i18n ; $ slugs = [ ] ; foreach ( $ i18nModels as $ i18nModel ) { if ( empty ( $ i18nModel -> body ) ) continue ; // skip languages for news without body
   $ slugs [ $ i18nModel -> lang_code ] = $ i18nModel -> slug ; } //$langs = array_keys(LangHelper::activeLanguages()); // better use as container-module's member:
   $ module = Module :: getModuleByClassname ( Module :: className ( ) ) ; $ langHelper = $ module -> langHelper ; $ langs = array_keys ( $ langHelper :: activeLanguages ( ) ) ; $ slug = '' ; foreach ( $ langs as $ lang ) { if ( ! empty ( $ slugs [ $ lang ] ) ) { $ slug = $ slugs [ $ lang ] ; break ; } } if ( strlen ( $ slug ) > static :: $ slugMaxLen ) { $ slug = substr ( $ slug , 0 , static :: $ slugMaxLen ) ; } $ slug = trim ( $ slug , '-' ) ; return $ slug ; }
docstring: Get first non-empty slug of news. Search in default languages priority.
  @param News $model
  @return string
docstring_tokens: Get first non - empty slug of news . Search in default languages priority .