function Yaml::encode

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
  2. 10 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
  3. 11.x core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()

Overrides SerializationInterface::encode

11 calls to Yaml::encode()
DependencyTest::testNoVersionInfo in core/modules/system/tests/src/Functional/Module/DependencyTest.php
Tests visiting admin/modules when a module outside of core has no version.
DistributionProfileExistingSettingsTest::prepareEnvironment in core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
Prepares the current environment for running the test.
ExtensionListTest::setupTestExtensionList in core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php
Sets up an a test extension list.
FrontMatterTest::createFrontMatterSource in core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
Creates a front matter source string.
GenerateTheme::execute in core/lib/Drupal/Core/Command/GenerateTheme.php

... See full list

File

core/lib/Drupal/Component/Serialization/Yaml.php, line 22

Class

Yaml
Provides a YAML serialization implementation.

Namespace

Drupal\Component\Serialization

Code

public static function encode($data) {
    // Instead of using \Drupal\Component\Serialization\Yaml::getSerializer(),
    // always using Symfony for writing the data, to reduce the risk of having
    // differences if different environments (like production and development)
    // do not match in terms of what YAML implementation is available.
    return YamlSymfony::encode($data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.