original_string: public function getFallbackPageExtensions($file_ext = null)
      {
          if (empty($this->page_extensions)) {
              if (!$file_ext) {
                  $file_ext = CONTENT_EXT;
              }
  
              if ($this->enabled()) {
                  $valid_lang_extensions = [];
                  foreach ($this->languages as $lang) {
                      $valid_lang_extensions[] = '.' . $lang . $file_ext;
                  }
  
                  if ($this->active) {
                      $active_extension = '.' . $this->active . $file_ext;
                      $key = \array_search($active_extension, $valid_lang_extensions, true);
  
                      // Default behavior is to find any language other than active
                      if ($this->config->get('system.languages.pages_fallback_only')) {
                          $slice = \array_slice($valid_lang_extensions, 0, $key+1);
                          $valid_lang_extensions = array_reverse($slice);
                      } else {
                          unset($valid_lang_extensions[$key]);
                          array_unshift($valid_lang_extensions, $active_extension);
                      }
                  }
                  $valid_lang_extensions[] = $file_ext;
                  $this->page_extensions = $valid_lang_extensions;
              } else {
                  $this->page_extensions = (array)$file_ext;
              }
          }
  
          return $this->page_extensions;
      }
code: public function getFallbackPageExtensions($file_ext = null)
      {
          if (empty($this->page_extensions)) {
              if (!$file_ext) {
                  $file_ext = CONTENT_EXT;
              }
  
              if ($this->enabled()) {
                  $valid_lang_extensions = [];
                  foreach ($this->languages as $lang) {
                      $valid_lang_extensions[] = '.' . $lang . $file_ext;
                  }
  
                  if ($this->active) {
                      $active_extension = '.' . $this->active . $file_ext;
                      $key = \array_search($active_extension, $valid_lang_extensions, true);
  
                      // Default behavior is to find any language other than active
                      if ($this->config->get('system.languages.pages_fallback_only')) {
                          $slice = \array_slice($valid_lang_extensions, 0, $key+1);
                          $valid_lang_extensions = array_reverse($slice);
                      } else {
                          unset($valid_lang_extensions[$key]);
                          array_unshift($valid_lang_extensions, $active_extension);
                      }
                  }
                  $valid_lang_extensions[] = $file_ext;
                  $this->page_extensions = $valid_lang_extensions;
              } else {
                  $this->page_extensions = (array)$file_ext;
              }
          }
  
          return $this->page_extensions;
      }
code_tokens: public function getFallbackPageExtensions ( $ file_ext = null ) { if ( empty ( $ this -> page_extensions ) ) { if ( ! $ file_ext ) { $ file_ext = CONTENT_EXT ; } if ( $ this -> enabled ( ) ) { $ valid_lang_extensions = [ ] ; foreach ( $ this -> languages as $ lang ) { $ valid_lang_extensions [ ] = '.' . $ lang . $ file_ext ; } if ( $ this -> active ) { $ active_extension = '.' . $ this -> active . $ file_ext ; $ key = \ array_search ( $ active_extension , $ valid_lang_extensions , true ) ; // Default behavior is to find any language other than active if ( $ this -> config -> get ( 'system.languages.pages_fallback_only' ) ) { $ slice = \ array_slice ( $ valid_lang_extensions , 0 , $ key + 1 ) ; $ valid_lang_extensions = array_reverse ( $ slice ) ; } else { unset ( $ valid_lang_extensions [ $ key ] ) ; array_unshift ( $ valid_lang_extensions , $ active_extension ) ; } } $ valid_lang_extensions [ ] = $ file_ext ; $ this -> page_extensions = $ valid_lang_extensions ; } else { $ this -> page_extensions = ( array ) $ file_ext ; } } return $ this -> page_extensions ; }
docstring: Gets an array of valid extensions with active first, then fallback extensions
  
  @param string|null $file_ext
  
  @return array
docstring_tokens: Gets an array of valid extensions with active first then fallback extensions