You are here

public function WebformElementBase::isMultiline in Webform 8.5

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

Checks if the element value could contain multiple lines.

Parameters

array $element: An element.

Return value

bool TRUE if the element value could contain multiple lines.

Overrides WebformElementInterface::isMultiline

4 calls to WebformElementBase::isMultiline()
OptionsBase::isMultiline in src/Plugin/WebformElement/OptionsBase.php
Checks if the element value could contain multiple lines.
WebformElementBase::build in src/Plugin/WebformElementBase.php
Build an element as text or HTML.
WebformElementBase::getRelatedTypes in src/Plugin/WebformElementBase.php
Get related element types.
WebformManagedFileBase::isMultiline in src/Plugin/WebformElement/WebformManagedFileBase.php
Checks if the element value could contain multiple lines.
2 methods override WebformElementBase::isMultiline()
OptionsBase::isMultiline in src/Plugin/WebformElement/OptionsBase.php
Checks if the element value could contain multiple lines.
WebformManagedFileBase::isMultiline in src/Plugin/WebformElement/WebformManagedFileBase.php
Checks if the element value could contain multiple lines.

File

src/Plugin/WebformElementBase.php, line 613

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

public function isMultiline(array $element) {
  $item_format = $this
    ->getItemFormat($element);
  $items_format = $this
    ->getItemsFormat($element);

  // Check is multi value element.
  if ($this
    ->hasMultipleValues($element) && in_array($items_format, [
    'ol',
    'ul',
    'hr',
    'custom',
  ])) {
    return TRUE;
  }

  // Check if custom items template has HTML block tags.
  if ($items_format === 'custom' && isset($element['#format_items_html']) && WebformHtmlHelper::hasBlockTags($element['#format_items_html'])) {
    return TRUE;
  }

  // Check if custom item template has HTML block tags.
  if ($item_format === 'custom' && isset($element['#format_html']) && WebformHtmlHelper::hasBlockTags($element['#format_html'])) {
    return TRUE;
  }
  return $this->pluginDefinition['multiline'];
}