You are here

abstract class OptionsBase in YAML Form 8

Provides a base 'options' element.

Hierarchy

Expanded class hierarchy of OptionsBase

File

src/Plugin/YamlFormElement/OptionsBase.php, line 16

Namespace

Drupal\yamlform\Plugin\YamlFormElement
View source
abstract class OptionsBase extends YamlFormElementBase {

  /**
   * Export delta for multiple options.
   *
   * @var bool
   */
  protected $exportDelta = FALSE;

  /**
   * {@inheritdoc}
   */
  public function getDefaultProperties() {
    $default_properties = parent::getDefaultProperties();

    // Issue #2836374: Wrapper attributes are not supported by composite
    // elements, this includes radios, checkboxes, and buttons.
    if (preg_match('/(radios|checkboxes|buttons)/', $this
      ->getPluginId())) {
      unset($default_properties['wrapper_attributes']);
    }
    return $default_properties + [
      // Options settings.
      'options' => [],
      'options_randomize' => FALSE,
    ];
  }

  /**
   * Get option (option) properties.
   *
   * @return array
   *   An associative array containing other (option) properties.
   */
  public function getOtherProperties() {
    return [
      'other__option_label' => $this
        ->t('Other...'),
      'other__type' => 'textfield',
      'other__title' => '',
      'other__placeholder' => $this
        ->t('Enter other...'),
      'other__description' => '',
      // Text field or textarea.
      'other__size' => '',
      'other__maxlength' => '',
      'other__field_prefix' => '',
      'other__field_suffix' => '',
      // Textarea.
      'other__rows' => '',
      // Number.
      'other__min' => '',
      'other__max' => '',
      'other__step' => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getTranslatableProperties() {
    return array_merge(parent::getTranslatableProperties(), [
      'options',
      'empty_option',
      'option_label',
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getRelatedTypes(array $element) {
    $related_types = parent::getRelatedTypes($element);

    // Remove entity reference elements.
    $elements = $this->elementManager
      ->getInstances();
    foreach ($related_types as $type => $related_type) {
      $element_instance = $elements[$type];
      if ($element_instance instanceof YamlFormEntityReferenceInterface) {
        unset($related_types[$type]);
      }
    }
    return $related_types;
  }

  /**
   * {@inheritdoc}
   */
  public function prepare(array &$element, YamlFormSubmissionInterface $yamlform_submission) {
    parent::prepare($element, $yamlform_submission);

    // Randomize options.
    if (isset($element['#options']) && !empty($element['#options_randomize'])) {
      shuffle($element['#options']);
    }
    $is_wrapper_fieldset = in_array($element['#type'], [
      'checkboxes',
      'radios',
    ]);
    if ($is_wrapper_fieldset) {

      // Issue #2396145: Option #description_display for form element fieldset
      // is not changing anything.
      // @see core/modules/system/templates/fieldset.html.twig
      $is_description_display = isset($element['#description_display']) ? TRUE : FALSE;
      $has_description = !empty($element['#description']) ? TRUE : FALSE;
      if ($is_description_display && $has_description) {
        switch ($element['#description_display']) {
          case 'before':
            $element += [
              '#field_prefix' => '',
            ];
            $element['#field_prefix'] = '<div class="description">' . $element['#description'] . '</div>' . $element['#field_prefix'];
            unset($element['#description']);
            break;
          case 'invisible':
            $element += [
              '#field_suffix' => '',
            ];
            $element['#field_suffix'] .= '<div class="description visually-hidden">' . $element['#description'] . '</div>';
            unset($element['#description']);
            break;
        }
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function hasMultipleValues(array $element) {
    return isset($element['#multiple']) ? $element['#multiple'] : parent::hasMultipleValues($element);
  }

  /**
   * {@inheritdoc}
   */
  public function setDefaultValue(array &$element) {
    if (!isset($element['#default_value'])) {
      return;
    }

    // Compensate for #default_value not being an array, for elements that
    // allow for multiple #options to be selected/checked.
    if ($this
      ->hasMultipleValues($element) && !is_array($element['#default_value'])) {
      $element['#default_value'] = [
        $element['#default_value'],
      ];
    }
  }

  /**
   * {@inheritdoc}
   */
  public function formatHtml(array &$element, $value, array $options = []) {
    if ($value && is_array($value) && ($list_type = $this
      ->getListType($element))) {
      $flattened_options = OptGroup::flattenOptions($element['#options']);
      return [
        '#theme' => 'item_list',
        '#items' => YamlFormOptionsHelper::getOptionsText($value, $flattened_options),
        '#list_type' => $list_type,
      ];
    }
    else {
      return parent::formatHtml($element, $value, $options);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function formatText(array &$element, $value, array $options = []) {

    // Return empty value.
    if ($value === '' || $value === NULL || is_array($value) && empty($value)) {
      return '';
    }
    $format = $this
      ->getFormat($element);
    $flattened_options = OptGroup::flattenOptions($element['#options']);

    // If not multiple options array return the simple value.
    if (!is_array($value)) {
      return $format == 'raw' ? $value : YamlFormOptionsHelper::getOptionText($value, $flattened_options);
    }
    $options_text = YamlFormOptionsHelper::getOptionsText($value, $flattened_options);
    switch ($format) {
      case 'ol':
        $list = [];
        $index = 1;
        foreach ($options_text as $option_text) {
          $list[] = $index++ . '. ' . $option_text;
        }
        return implode("\n", $list);
      case 'ul':
        $list = [];
        foreach ($options_text as $index => $option_text) {
          $list[] = '- ' . $option_text;
        }
        return implode("\n", $list);
      case 'and':
        return YamlFormArrayHelper::toString($options_text, t('and'));
      case 'comma':
        return implode(', ', $options_text);
      case 'semicolon':
        return implode('; ', $options_text);
      case 'raw':
        return implode(', ', $value);
      default:
        return implode($format, $options_text);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function isMultiline(array $element) {
    if ($this
      ->isList($element)) {
      return TRUE;
    }
    else {
      return parent::isMultiline($element);
    }
  }

  /**
   * Determine if options element is being displayed as list.
   *
   * @param array $element
   *   An element.
   *
   * @return bool
   *   TRUE if options element is being displayed as ul or ol list.
   */
  protected function isList(array $element) {
    return $this
      ->getListType($element) ? TRUE : FALSE;
  }

  /**
   * Get the element's list type.
   *
   * @param array $element
   *   An element.
   *
   * @return string
   *   List type ul or ol or NULL is element is not formatted as a list.
   */
  protected function getListType(array $element) {
    $format = $this
      ->getFormat($element);
    switch ($format) {
      case 'ol':
      case 'ordered':
        return 'ol';
      case 'ul':
      case 'unordered':
      case 'list':
        return 'ul';
      default:
        return NULL;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getDefaultFormat() {
    return 'comma';
  }

  /**
   * {@inheritdoc}
   */
  public function getFormats() {
    return parent::getFormats() + [
      'comma' => $this
        ->t('Comma'),
      'semicolon' => $this
        ->t('Semicolon'),
      'and' => $this
        ->t('And'),
      'ol' => $this
        ->t('Ordered list'),
      'ul' => $this
        ->t('Unordered list'),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getTableColumn(array $element) {
    $key = $element['#yamlform_key'];
    $columns = parent::getTableColumn($element);
    $columns['element__' . $key]['sort'] = !$this
      ->hasMultipleValues($element);
    return $columns;
  }

  /**
   * {@inheritdoc}
   */
  public function getExportDefaultOptions() {
    return [
      'options_format' => 'compact',
      'options_item_format' => 'label',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildExportOptionsForm(array &$form, FormStateInterface $form_state, array $export_options) {
    if (isset($form['options'])) {
      return;
    }
    $form['options'] = [
      '#type' => 'details',
      '#title' => $this
        ->t('Select menu, radio buttons, and checkboxes options'),
      '#open' => TRUE,
      '#weight' => -10,
    ];
    $form['options']['options_format'] = [
      '#type' => 'radios',
      '#title' => $this
        ->t('Options format'),
      '#options' => [
        'compact' => $this
          ->t('Compact; with the option values delimited by commas in one column.') . '<div class="description">' . $this
          ->t('Compact options are more suitable for importing data into other systems.') . '</div>',
        'separate' => $this
          ->t('Separate; with each possible option value in its own column.') . '<div class="description">' . $this
          ->t('Separate options are more suitable for building reports, graphs, and statistics in a spreadsheet application. Ranking will be included for sortable option elements.') . '</div>',
      ],
      '#default_value' => $export_options['options_format'],
    ];
    $form['options']['options_item_format'] = [
      '#type' => 'radios',
      '#title' => $this
        ->t('Options item format'),
      '#options' => [
        'label' => $this
          ->t('Option labels, the human-readable value (label)'),
        'key' => $this
          ->t('Option values, the raw value stored in the database (key)'),
      ],
      '#default_value' => $export_options['options_item_format'],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildExportHeader(array $element, array $options) {
    if ($options['options_format'] == 'separate' && isset($element['#options'])) {
      $header = [];
      foreach ($element['#options'] as $option_value => $option_text) {

        // Note: If $option_text is an array (typically a tableselect row)
        // always use $option_value.
        $title = $options['options_item_format'] == 'key' || is_array($option_text) ? $option_value : $option_text;
        $header[] = $title;
      }
      return $this
        ->prefixExportHeader($header, $element, $options);
    }
    else {
      return parent::buildExportHeader($element, $options);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function buildExportRecord(array $element, $value, array $export_options) {
    $element_options = $element['#options'];
    $record = [];
    if ($export_options['options_format'] == 'separate') {

      // Combine the values so that isset can be used instead of in_array().
      // http://stackoverflow.com/questions/13483219/what-is-faster-in-array-or-isset
      $deltas = FALSE;
      if (is_array($value)) {
        $value = array_combine($value, $value);
        $deltas = $this->exportDelta ? array_flip(array_values($value)) : FALSE;
      }

      // Separate multiple values (ie options).
      foreach ($element_options as $option_value => $option_text) {
        if (is_array($value) && isset($value[$option_value]) || $value == $option_value) {
          $record[] = $deltas ? $deltas[$option_value] + 1 : 'X';
        }
        else {
          $record[] = '';
        }
      }
    }
    else {

      // Handle multiple values with options.
      if (is_array($value)) {
        if ($export_options['options_item_format'] == 'label') {
          $value = YamlFormOptionsHelper::getOptionsText($value, $element_options);
        }
        $record[] = implode(',', $value);
      }
      elseif ($export_options['options_item_format'] == 'label') {
        $record[] = YamlFormOptionsHelper::getOptionText($value, $element_options);
      }
      else {
        $record[] = $value;
      }
    }
    return $record;
  }

  /**
   * Form API callback. Remove unchecked options from value array.
   */
  public static function validateMultipleOptions(array &$element, FormStateInterface $form_state) {
    $name = $element['#name'];
    $values = $form_state
      ->getValue($name);

    // Filter unchecked/unselected options whose value is 0.
    $values = array_filter($values, function ($value) {
      return $value !== 0;
    });
    $values = array_values($values);
    $form_state
      ->setValue($name, $values);
  }

  /**
   * {@inheritdoc}
   */
  protected function getElementSelectorInputsOptions(array $element) {
    $plugin_id = $this
      ->getPluginId();
    if (preg_match('/yamlform_(select|radios|checkboxes|buttons)_other$/', $plugin_id, $match)) {
      $title = $this
        ->getAdminLabel($element);
      list($element_type) = explode(' ', $this
        ->getPluginLabel());
      $inputs = [];
      $inputs[$match[1]] = $title . ' [' . $element_type . ']';
      $inputs['other'] = $title . ' [' . $this
        ->t('Text field') . ']';
      return $inputs;
    }
    else {
      return [];
    }
  }

  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);
    $form['general']['default_value']['#description'] = $this
      ->t('The default value of the field identified by its key.');
    $form['general']['default_value']['#description'] .= ' ' . $this
      ->t('For multiple options, use commas to separate multiple defaults.');

    // Issue #2836374: Wrapper attributes are not supported by composite
    // elements, this includes radios, checkboxes, and buttons.
    if (preg_match('/(radios|checkboxes|buttons)/', $this
      ->getPluginId())) {
      $t_args = [
        '@name' => Unicode::strtolower($this
          ->getPluginLabel()),
        ':href' => 'https://www.drupal.org/node/2836364',
      ];
      $form['element_attributes']['#description'] = $this
        ->t('Please note: That the below custom element attributes will also be applied to the @name fieldset wrapper. (<a href=":href">Issue #2836374</a>)', $t_args);
    }

    // Options.
    $form['options'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Element options'),
      '#open' => TRUE,
    ];
    $form['options']['options'] = [
      '#type' => 'yamlform_element_options',
      '#title' => $this
        ->t('Options'),
      '#required' => TRUE,
    ];
    $form['options']['options_display'] = [
      '#title' => $this
        ->t('Options display'),
      '#type' => 'select',
      '#options' => [
        'one_column' => $this
          ->t('One column'),
        'two_columns' => $this
          ->t('Two columns'),
        'three_columns' => $this
          ->t('Three columns'),
        'side_by_side' => $this
          ->t('Side by side'),
      ],
    ];
    $form['options']['empty_option'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Empty option label'),
      '#description' => $this
        ->t('The label to show for the initial option denoting no selection in a select element.'),
    ];
    $form['options']['empty_value'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Empty option value'),
      '#description' => $this
        ->t('The value for the initial option denoting no selection in a select element, which is used to determine whether the user submitted a value or not.'),
    ];
    $form['options']['multiple'] = [
      '#title' => $this
        ->t('Multiple'),
      '#type' => 'checkbox',
      '#return_value' => TRUE,
      '#description' => $this
        ->t('Check this option if the user should be allowed to choose multiple values.'),
    ];
    $form['options']['options_randomize'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Randomize options'),
      '#description' => $this
        ->t('Randomizes the order of the options when they are displayed in the form.'),
      '#return_value' => TRUE,
    ];

    // Other.
    $states_textfield_or_number = [
      'visible' => [
        [
          ':input[name="properties[other__type]"]' => [
            'value' => 'textfield',
          ],
        ],
        'or',
        [
          ':input[name="properties[other__type]"]' => [
            'value' => 'number',
          ],
        ],
      ],
    ];
    $states_textarea = [
      'visible' => [
        ':input[name="properties[other__type]"]' => [
          'value' => 'textarea',
        ],
      ],
    ];
    $states_number = [
      'visible' => [
        ':input[name="properties[other__type]"]' => [
          'value' => 'number',
        ],
      ],
    ];
    $form['options_other'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Other option settings'),
    ];
    $form['options_other']['other__type'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Other type'),
      '#options' => [
        'textfield' => $this
          ->t('Text field'),
        'textarea' => $this
          ->t('Textarea'),
        'number' => $this
          ->t('Number'),
      ],
    ];
    $form['options_other']['other__option_label'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other option label'),
    ];
    $form['options_other']['other__title'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other title'),
    ];
    $form['options_other']['other__placeholder'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other placeholder'),
    ];
    $form['options_other']['other__description'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other description'),
    ];
    $form['options_other']['other__size'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other size'),
      '#description' => $this
        ->t('Leaving blank will use the default size.'),
      '#min' => 1,
      '#size' => 4,
      '#states' => $states_textfield_or_number,
    ];
    $form['options_other']['other__maxlength'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other maxlength'),
      '#description' => $this
        ->t('Leaving blank will use the default maxlength.'),
      '#min' => 1,
      '#size' => 4,
      '#states' => $states_textfield_or_number,
    ];
    $form['options_other']['other__field_prefix'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other field prefix'),
      '#description' => $this
        ->t('Text or code that is placed directly in front of the input. This can be used to prefix an input with a constant string. Examples: $, #, -.'),
      '#size' => 10,
      '#states' => $states_textfield_or_number,
    ];
    $form['options_other']['other__field_suffix'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Other field suffix'),
      '#description' => $this
        ->t('Text or code that is placed directly after the input. This can be used to add a unit to an input. Examples: lb, kg, %.'),
      '#size' => 10,
      '#states' => $states_textfield_or_number,
    ];
    $form['options_other']['other__rows'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other rows'),
      '#description' => $this
        ->t('Leaving blank will use the default rows.'),
      '#min' => 1,
      '#size' => 4,
      '#states' => $states_textarea,
    ];
    $form['options_other']['other__min'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other min'),
      '#description' => $this
        ->t('Specifies the minimum value.'),
      '#step' => 'any',
      '#size' => 4,
      '#states' => $states_number,
    ];
    $form['options_other']['other__max'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other max'),
      '#description' => $this
        ->t('Specifies the maximum value.'),
      '#step' => 'any',
      '#size' => 4,
      '#states' => $states_number,
    ];
    $form['options_other']['other__step'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Other steps'),
      '#description' => $this
        ->t('Specifies the legal number intervals. Leave blank to support any number interval.'),
      '#step' => 'any',
      '#size' => 4,
      '#states' => $states_number,
    ];
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OptionsBase::$exportDelta protected property Export delta for multiple options. 2
OptionsBase::buildExportHeader public function Build an element's export header. Overrides YamlFormElementBase::buildExportHeader
OptionsBase::buildExportOptionsForm public function Get an element's export options form. Overrides YamlFormElementBase::buildExportOptionsForm
OptionsBase::buildExportRecord public function Build an element's export row. Overrides YamlFormElementBase::buildExportRecord
OptionsBase::form public function Gets the actual configuration form array to be built. Overrides YamlFormElementBase::form 1
OptionsBase::formatHtml public function Format an element's value as HTML. Overrides YamlFormElementBase::formatHtml
OptionsBase::formatText public function Format an element's value as plain text. Overrides YamlFormElementBase::formatText
OptionsBase::getDefaultFormat public function Get an element's default format name. Overrides YamlFormElementBase::getDefaultFormat 2
OptionsBase::getDefaultProperties public function Only a few elements don't inherit these default properties. Overrides YamlFormElementBase::getDefaultProperties 8
OptionsBase::getElementSelectorInputsOptions protected function Get an element's (sub)inputs selectors as options. Overrides YamlFormElementBase::getElementSelectorInputsOptions 2
OptionsBase::getExportDefaultOptions public function Get an element's default export options. Overrides YamlFormElementBase::getExportDefaultOptions
OptionsBase::getFormats public function Get an element's available formats. Overrides YamlFormElementBase::getFormats
OptionsBase::getListType protected function Get the element's list type.
OptionsBase::getOtherProperties public function Get option (option) properties.
OptionsBase::getRelatedTypes public function Get related element types. Overrides YamlFormElementBase::getRelatedTypes
OptionsBase::getTableColumn public function Get element's table column(s) settings. Overrides YamlFormElementBase::getTableColumn
OptionsBase::getTranslatableProperties public function Get translatable properties. Overrides YamlFormElementBase::getTranslatableProperties
OptionsBase::hasMultipleValues public function Checks if element value has multiple values. Overrides YamlFormElementBase::hasMultipleValues 2
OptionsBase::isList protected function Determine if options element is being displayed as list.
OptionsBase::isMultiline public function Checks if element value could contain multiple lines. Overrides YamlFormElementBase::isMultiline
OptionsBase::prepare public function Prepare an element to be rendered within a form. Overrides YamlFormElementBase::prepare 3
OptionsBase::setDefaultValue public function Set an element's default value using saved data. Overrides YamlFormElementBase::setDefaultValue
OptionsBase::validateMultipleOptions public static function Form API callback. Remove unchecked options from value array.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
YamlFormElementBase::$configFactory protected property The configuration factory.
YamlFormElementBase::$currentUser protected property The current user.
YamlFormElementBase::$elementInfo protected property A element info manager.
YamlFormElementBase::$elementManager protected property The form element manager.
YamlFormElementBase::$entityTypeManager protected property The entity type manager.
YamlFormElementBase::$logger protected property A logger instance.
YamlFormElementBase::$tokenManager protected property The token manager.
YamlFormElementBase::build protected function Build an element as text or HTML. 2
YamlFormElementBase::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm 1
YamlFormElementBase::buildHtml public function Build an element as HTML element. Overrides YamlFormElementInterface::buildHtml 1
YamlFormElementBase::buildText public function Build an element as text element. Overrides YamlFormElementInterface::buildText 1
YamlFormElementBase::checkAccessRules public function Check element access (rules). Overrides YamlFormElementInterface::checkAccessRules
YamlFormElementBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
YamlFormElementBase::displayDisabledWarning public function Display element disabled warning. Overrides YamlFormElementInterface::displayDisabledWarning 1
YamlFormElementBase::formatTableColumn public function Format an element's table column value. Overrides YamlFormElementInterface::formatTableColumn 2
YamlFormElementBase::getAdminLabel public function Get an element's admin label (#admin_title, #title or #yamlform_key). Overrides YamlFormElementInterface::getAdminLabel
YamlFormElementBase::getConfigurationFormProperties public function Get an associative array of element properties from configuration form. Overrides YamlFormElementInterface::getConfigurationFormProperties 2
YamlFormElementBase::getConfigurationFormProperty protected function Get configuration property value. 1
YamlFormElementBase::getDefaultBaseProperties protected function Get default base properties used by all elements.
YamlFormElementBase::getElementSelectorOptions public function Get an element's selectors as options. Overrides YamlFormElementInterface::getElementSelectorOptions 11
YamlFormElementBase::getElementStateOptions public function Get an element's supported states as options. Overrides YamlFormElementInterface::getElementStateOptions
YamlFormElementBase::getFormat public function Get element's format name by looking for '#format' property, global settings, and finally default settings. Overrides YamlFormElementInterface::getFormat 1
YamlFormElementBase::getInfo public function Retrieves the default properties for the defined element type. Overrides YamlFormElementInterface::getInfo
YamlFormElementBase::getKey public function Get an element's key/name. Overrides YamlFormElementInterface::getKey
YamlFormElementBase::getLabel public function Get an element's label (#title or #yamlform_key). Overrides YamlFormElementInterface::getLabel
YamlFormElementBase::getPluginApiLink public function Get link to element's API documentation. Overrides YamlFormElementInterface::getPluginApiLink
YamlFormElementBase::getPluginApiUrl public function Get the URL for the element's API documentation. Overrides YamlFormElementInterface::getPluginApiUrl
YamlFormElementBase::getPluginLabel public function Gets the label of the plugin instance. Overrides YamlFormElementInterface::getPluginLabel
YamlFormElementBase::getTestValue public function Get test value for an element. Overrides YamlFormElementInterface::getTestValue 7
YamlFormElementBase::getTypeName public function Gets the type name (aka id) of the plugin instance with the 'yamlform_' prefix. Overrides YamlFormElementInterface::getTypeName
YamlFormElementBase::hasProperty public function Determine if an element supports a specified property. Overrides YamlFormElementInterface::hasProperty
YamlFormElementBase::hasWrapper public function Checks if the element has a wrapper. Overrides YamlFormElementInterface::hasWrapper
YamlFormElementBase::initialize public function Initialize an element to be displayed, rendered, or exported. Overrides YamlFormElementInterface::initialize 1
YamlFormElementBase::isComposite public function Checks if element is a composite element. Overrides YamlFormElementInterface::isComposite
YamlFormElementBase::isContainer public function Checks if element is a container that can contain elements. Overrides YamlFormElementInterface::isContainer 3
YamlFormElementBase::isDisabled public function Checks if element is disabled. Overrides YamlFormElementInterface::isDisabled
YamlFormElementBase::isEnabled public function Checks if element is enabled. Overrides YamlFormElementInterface::isEnabled 1
YamlFormElementBase::isHidden public function Checks if element is hidden. Overrides YamlFormElementInterface::isHidden
YamlFormElementBase::isInput public function Checks if the element carries a value. Overrides YamlFormElementInterface::isInput 5
YamlFormElementBase::isRoot public function Checks if element is a root element. Overrides YamlFormElementInterface::isRoot 1
YamlFormElementBase::postCreate public function Acts on a form submission element after it is created. Overrides YamlFormElementInterface::postCreate 1
YamlFormElementBase::postDelete public function Delete any additional value associated with an element. Overrides YamlFormElementInterface::postDelete 2
YamlFormElementBase::postLoad public function Acts on loaded form submission. Overrides YamlFormElementInterface::postLoad 1
YamlFormElementBase::postSave public function Acts on a saved form submission element before the insert or update hook is invoked. Overrides YamlFormElementInterface::postSave 2
YamlFormElementBase::preCreate public function Changes the values of an entity before it is created. Overrides YamlFormElementInterface::preCreate 1
YamlFormElementBase::preDelete public function 1
YamlFormElementBase::prefixExportHeader protected function Prefix an element's export header.
YamlFormElementBase::prepareWrapper protected function Set an elements Flexbox and #states wrapper. 1
YamlFormElementBase::preSave public function Acts on a form submission element before the presave hook is invoked. Overrides YamlFormElementInterface::preSave 2
YamlFormElementBase::setConfigurationFormDefaultValue protected function Set an element's configuration form element default value. 2
YamlFormElementBase::setConfigurationFormDefaultValueRecursive protected function Set configuration form default values recursively.
YamlFormElementBase::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
YamlFormElementBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm 3
YamlFormElementBase::validateUnique public static function Form API callback. Validate #unique value.
YamlFormElementBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct