You are here

protected static function WebformCodeMirror::getTitle in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformCodeMirror.php \Drupal\webform\Element\WebformCodeMirror::getTitle()

Get an element's title.

Parameters

array $element: An element.

Return value

string The element's title.

1 call to WebformCodeMirror::getTitle()
WebformCodeMirror::validateWebformCodeMirror in src/Element/WebformCodeMirror.php
Webform element validation handler for #type 'webform_codemirror'.

File

src/Element/WebformCodeMirror.php, line 203

Class

WebformCodeMirror
Provides a webform element for using CodeMirror.

Namespace

Drupal\webform\Element

Code

protected static function getTitle(array $element) {
  if (isset($element['#title'])) {
    return $element['#title'];
  }
  switch ($element['#mode']) {
    case 'html':
      return t('HTML');
    case 'yaml':
      return t('YAML');
    case 'twig':
      return t('Twig');
    default:
      return t('Code');
  }
}