You are here

public function WebformElementBase::getItemFormat in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElementBase.php \Drupal\webform\Plugin\WebformElementBase::getItemFormat()

Get element's single value format name by looking for '#format' property, global settings, and finally default settings.

Parameters

array $element: An element.

Return value

string An element's format name.

Overrides WebformElementInterface::getItemFormat

45 calls to WebformElementBase::getItemFormat()
Address::formatHtmlItem in src/Plugin/WebformElement/Address.php
Format an element's value as HTML.
Address::formatTextItem in src/Plugin/WebformElement/Address.php
Format an element's value as text.
BooleanBase::formatTextItem in src/Plugin/WebformElement/BooleanBase.php
Format an element's value as text.
Color::formatHtmlItem in src/Plugin/WebformElement/Color.php
Format an element's value as HTML.
ContainerBase::formatHtmlItem in src/Plugin/WebformElement/ContainerBase.php
Format an element's value as HTML.

... See full list

1 method overrides WebformElementBase::getItemFormat()
Date::getItemFormat in src/Plugin/WebformElement/Date.php
Get element's single value format name by looking for '#format' property, global settings, and finally default settings.

File

src/Plugin/WebformElementBase.php, line 1823

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

public function getItemFormat(array $element) {
  if (isset($element['#format'])) {
    return $element['#format'];
  }
  elseif ($default_format = $this->configFactory
    ->get('webform.settings')
    ->get('format.' . $this
    ->getPluginId() . '.item')) {
    return $default_format;
  }
  else {
    return $this
      ->getItemDefaultFormat();
  }
}