Prepare Joomla 5

BethicoLeague 5 deprecated

BethicoLeague 3.10 BethicoLeague 5.0
IPL_CUR_SEASON_ID $model['season']→activeSeasonId()
BETHICO_TEMPLATE_URI URI::base(true).'/templates/'.Factory::getApplication()→getTemplate(true)→template
BETHICO_STANDINGS_VIEW $model['season']→teamLeague()
$bethicoMainConfig $model['season']→getMainConfig($seasonId)
$bethicoConfig $model['season']→getConfig($seasonId)
$bethicoTeamLeague Factory::getApplication()→getParams()→get('team_league')
$bethicoLeague Factory::getApplication()→getParams()→get('league_type')
$bethicoByeTerm Factory::getApplication()→getParams()→get('bye_term')
$bethicoTeamLeague $model['season']→teamLeague()
$model['league']→teamLeague()
db: #__bethico_config->league options: league_type
db: #__bethico_config->league_code options: league_code
(db prefix if empty)
db: #__bethico_config->time_string options: time_locale
db: #__bethico_config->start_year options: start_year
mod_bethico_legal: year
db: #__bethico_config->frames_term options: frames_term
db: #__bethico_config->bye_term options: bye_term
options: wiki options: wikiURL FIXME

Todo Admin

  • FIXME check and set options if empty in Plugin Bethico or BethicoAdmin:
    use Joomla\CMS\Plugin\CMSPlugin;
    use Joomla\Event\Event;
    
    class PlgSystemMyPlugin extends CMSPlugin
    {
        public function onExtensionBeforeSave($context, $table)
        {
            // 1. Check if we are saving component options (com_config)
            if ($context !== 'com_config.component') {
                return;
            }
    
            // 2. Identify which component's options were saved
            $componentName = $table->element; // e.g., 'com_content'
            
            if ($componentName === 'com_mycomponent') {
                // 3. React to the save (e.g., clear cache, log activity)
                $params = $table->params; // The new parameters
                // Your custom logic here
                // check whether we can modify $table, or we need to call $table->params->set('start_year', date('Y'));
            }
        }
    }
  • FIXME Change Special games selection and logic in Admin: Tournament view

Todo Site

Todo Wiki

  • Change favicon for help screens
  • Change option names in Admin: Tournament View

Get model

public function getOtherModelData()
    {
        // ... some logic ...

        // Get an instance of 'MyModel2' from the same component (e.g., 'com_mycomponent')
        // Assumes MyModel2 is in the Site directory if the current model is in Site
        $otherModel = Factory::getApplication()
            ->bootComponent('com_mycomponent')
            ->getMVCFactory()
            ->createModel('MyModel2', 'Site'); // Replace 'Site' with 'Administrator', 'Cli', or 'Api' if needed

        // Now you can call methods on the other model
        $items = $otherModel->getItems(); // Example method call

        return $items;
    } 

Joomla 5 deprecated

Joomla 3.10 Joomla 5.0 Joomla 6.0
Factory::getConfig() $app→getConfig()
Factory::getApplication()→getConfig()
$app→getConfig()

Joomla 5 changes

My code Joomla 3.10 Joomla 5.0
admin.js: alert alert(msg); import('joomla.dialog').then(m ⇒ m.default.alert(Joomla.JText._('COM_BETHICOLEAGUE_JS_CANNOT_SELECT')));
import('joomla.dialog').then(m ⇒ m.default.alert(Joomla.JText._('COM_BETHICOLEAGUE_JS_CANNOT_SELECT'), Joomla.Text._('INFO', 'Info')));
admin.js: alert alert(msg); import('joomla.dialog').then(m ⇒ m.default.alert(Joomla.JText._('COM_BETHICOLEAGUE_JS_CANNOT_SELECT'), Joomla.Text._('WARNING', 'Warning')));
admin.js: confirm import('joomla.dialog').then(m ⇒ m.default.confirm(Joomla.JText._('COM_BETHICOLEAGUE_JS_YES_NO'), Joomla.Text._('WARNING', 'Warning'))).then(confirmed ⇒ {if (confirmed) {}});

Bootstrap

Joomla 3.10: version 2.3.2 Joomla 5.4: version 5.3.8

Effect Bootstrap 2.3.2 Bootstrap 5.3.8 BethicoLeague
Column Classes row-fluid
span7
span5
container
row
col col-12 col-lg-7
col-12 col-lg-5

Joomla 5 incompatibilities

  • WebAssetManager paths
  • Language strings: no multiline

Database changes

  • Table #__bethico_bar renamed to #__bethico_venue and fields starting with b_ renamed to starting with v_
  • fields league, league_code, time_string, start_year, frames_term, bye_term from #__bethico_config moved to component options
  • Table #__bethico_olddb_team field b_name renamed to v_name