You are here

class LanguageNegotiationTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php \Drupal\language_test\Plugin\LanguageNegotiation\LanguageNegotiationTest

Class for identifying language from a selected language.

Plugin annotation


@LanguageNegotiation(
  id = "test_language_negotiation_method",
  weight = -10,
  name = @Translation("Test"),
  description = @Translation("This is a test language negotiation method."),
  types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT,
  "test_language_type", "fixed_test_language_type"}
)

Hierarchy

Expanded class hierarchy of LanguageNegotiationTest

File

core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php, line 25
Contains \Drupal\language_test\Plugin\LanguageNegotiation\LanguageNegotiationTest.

Namespace

Drupal\language_test\Plugin\LanguageNegotiation
View source
class LanguageNegotiationTest extends LanguageNegotiationMethodBase {

  /**
   * The language negotiation method id.
   */
  const METHOD_ID = 'test_language_negotiation_method';

  /**
   * {@inheritdoc}
   */
  public function getLangcode(Request $request = NULL) {
    return 'it';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LanguageNegotiationMethodBase::$config protected property The configuration factory.
LanguageNegotiationMethodBase::$currentUser protected property The current active user.
LanguageNegotiationMethodBase::$languageManager protected property The language manager.
LanguageNegotiationMethodBase::persist public function Notifies the plugin that the language code it returned has been accepted. Overrides LanguageNegotiationMethodInterface::persist 1
LanguageNegotiationMethodBase::setConfig public function Injects the configuration factory. Overrides LanguageNegotiationMethodInterface::setConfig
LanguageNegotiationMethodBase::setCurrentUser public function Injects the current user. Overrides LanguageNegotiationMethodInterface::setCurrentUser
LanguageNegotiationMethodBase::setLanguageManager public function Injects the language manager. Overrides LanguageNegotiationMethodInterface::setLanguageManager
LanguageNegotiationTest::getLangcode public function Performs language negotiation. Overrides LanguageNegotiationMethodInterface::getLangcode
LanguageNegotiationTest::METHOD_ID constant The language negotiation method id. 1