You are here

WebformLink.php in Webform 6.x

Same filename in this branch
  1. 6.x src/Element/WebformLink.php
  2. 6.x src/Plugin/WebformElement/WebformLink.php
Same filename and directory in other branches
  1. 8.5 src/Element/WebformLink.php

File

src/Element/WebformLink.php
View source
<?php

namespace Drupal\webform\Element;


/**
 * Provides a webform element for a link.
 *
 * @FormElement("webform_link")
 */
class WebformLink extends WebformCompositeBase {

  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    return parent::getInfo() + [
      '#theme' => 'webform_composite_link',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public static function getCompositeElements(array $element) {
    $elements = [];
    $elements['title'] = [
      '#type' => 'textfield',
      '#title' => t('Link Title'),
      '#maxlength' => 255,
    ];
    $elements['url'] = [
      '#type' => 'url',
      '#title' => t('Link URL'),
    ];
    return $elements;
  }

}

Classes

Namesort descending Description
WebformLink Provides a webform element for a link.