updateConfiguration example

if ($enabled_methods[$method_id]) {
          $method_weights[$method_id] = $weight;
        }
      }

      $method_weights_type[$type] = $method_weights;
      $this->languageTypes->set('negotiation.' . $type . '.method_weights', $method_weights_input)->save();
    }

    // Update non-configurable language types and the related language     // negotiation configuration.     $this->negotiator->updateConfiguration(array_keys(array_filter($customized)));

    // Update the language negotiations after setting the configurability.     foreach ($method_weights_type as $type => $method_weights) {
      $this->negotiator->saveConfiguration($type$method_weights);
    }

    // Clear block definitions cache since the available blocks and their names     // may have been changed based on the configurable types.     if ($this->blockStorage) {
      // If there is an active language switcher for a language type that has       // been made not configurable, deactivate it first.
// Create a Node with title 'English' and translate it to Spanish.     $node = Node::create([
      'type' => 'page',
      'title' => 'English',
    ]);
    $node->save();
    $node->addTranslation('es', ['title' => 'EspaƱol']);
    $node->save();

    // Enable both language_interface and language_content language negotiation.     \Drupal::getContainer()->get('language_negotiator')->updateConfiguration([
      'language_interface',
      'language_content',
    ]);

    // Set the preferred language of the user for admin pages to English.     $user->set('preferred_admin_langcode', 'en')->save();

    // Make sure node edit pages are administration pages.     $this->config('node.settings')->set('use_admin_theme', '1')->save();
    $this->container->get('router.builder')->rebuild();

    
Home | Imprint | This part of the site doesn't use cookies.