You are here

function varbase_configure_multilingual in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.7

Same name and namespace in other branches
  1. 8.8 varbase.profile \varbase_configure_multilingual()
  2. 8.4 varbase.profile \varbase_configure_multilingual()
  3. 8.5 varbase.profile \varbase_configure_multilingual()
  4. 8.6 varbase.profile \varbase_configure_multilingual()
  5. 9.0.x varbase.profile \varbase_configure_multilingual()

Batch job to configure multilingual components.

Parameters

array $install_state: The current install state.

Return value

array The batch job definition.

File

./varbase.profile, line 317
Enables modules and site configuration for a Varbase site installation.

Code

function varbase_configure_multilingual(array &$install_state) {
  $batch = [];

  // If the multiligual config checkbox were checked.
  if (isset($install_state['varbase']['enable_multilingual']) && $install_state['varbase']['enable_multilingual'] == TRUE) {

    // Install the Varbase internationalization feature module.
    $batch['operations'][] = [
      'varbase_assemble_extra_component_then_install',
      (array) 'varbase_internationalization',
    ];

    // Add all selected languages and then translatvarbase_hide_messagesion
    // will fetched for theme.
    if (isset($install_state['varbase']['multilingual_languages']) && is_array($install_state['varbase']['multilingual_languages'])) {
      foreach ($install_state['varbase']['multilingual_languages'] as $language_code) {
        $batch['operations'][] = [
          'varbase_configure_language_and_fetch_traslation',
          (array) $language_code,
        ];
      }
    }

    // Hide Wornings and status messages.
    $batch['operations'][] = [
      'varbase_hide_warning_and_status_messages',
      (array) TRUE,
    ];

    // Change configurations to work with enable_multilingual.
    $batch['operations'][] = [
      'varbase_config_bit_for_multilingual',
      (array) TRUE,
    ];
  }
  else {

    // Change configurations to work with NO multilingual.
    $batch['operations'][] = [
      'varbase_config_bit_for_multilingual',
      (array) FALSE,
    ];
  }

  // Fix entity updates to clear up any mismatched entity.
  $batch['operations'][] = [
    'varbase_fix_entity_update',
    (array) TRUE,
  ];
  return $batch;
}