function FormatterPluginManager::getDefaultSettings

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/FormatterPluginManager.php \Drupal\Core\Field\FormatterPluginManager::getDefaultSettings()
  2. 10 core/lib/Drupal/Core/Field/FormatterPluginManager.php \Drupal\Core\Field\FormatterPluginManager::getDefaultSettings()
  3. 11.x core/lib/Drupal/Core/Field/FormatterPluginManager.php \Drupal\Core\Field\FormatterPluginManager::getDefaultSettings()

Returns the default settings of a field formatter.

Parameters

string $type: A field formatter type name.

Return value

array The formatter type's default settings, as provided by the plugin definition, or an empty array if type or settings are undefined.

1 call to FormatterPluginManager::getDefaultSettings()
FormatterPluginManager::prepareConfiguration in core/lib/Drupal/Core/Field/FormatterPluginManager.php
Merges default values for formatter configuration.

File

core/lib/Drupal/Core/Field/FormatterPluginManager.php, line 201

Class

FormatterPluginManager
Plugin type manager for field formatters.

Namespace

Drupal\Core\Field

Code

public function getDefaultSettings($type) {
    $plugin_definition = $this->getDefinition($type, FALSE);
    if (!empty($plugin_definition['class'])) {
        $plugin_class = DefaultFactory::getPluginClass($type, $plugin_definition);
        return $plugin_class::defaultSettings();
    }
    return [];
}

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