You are here

protected function ProcessedText::defineDefaultProperties in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/ProcessedText.php \Drupal\webform\Plugin\WebformElement\ProcessedText::defineDefaultProperties()

Define an element's default properties.

Return value

array An associative array contain an the element's default properties.

Overrides WebformMarkupBase::defineDefaultProperties

File

src/Plugin/WebformElement/ProcessedText.php, line 43

Class

ProcessedText
Provides a 'processed_text' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function defineDefaultProperties() {
  if (function_exists('filter_formats')) {

    // Works around filter_default_format() throwing fatal error when
    // user is not allowed to use any filter formats.
    // @see filter_default_format.
    $formats = filter_formats($this->currentUser);
    $format = reset($formats);
    $default_format = $format ? $format
      ->id() : filter_fallback_format();
  }
  else {
    $default_format = '';
  }
  return [
    'wrapper_attributes' => [],
    'label_attributes' => [],
    // Markup settings.
    'text' => '',
    'format' => $default_format,
  ] + parent::defineDefaultProperties();
}