layoutcomponents-8.x-1.14-beta2/src/Api/Text.php

src/Api/Text.php
<?php

namespace Drupal\layoutcomponents\Api;

use Drupal\layoutcomponents\Api\General as General;

/**
 * Class Text.
 *
 * Provide text form element.
 */
class Text {

  use General;

  /**
   * Provide the processed element text.
   *
   * @param array $data
   *   The default values.
   * @param string $type
   *   The new type.
   */
  public function plainText(array $data, $type = '') {
    $data['attributes']['lc']['input'] = 'ckeditor';
    $element = [];
    // Default values.
    if (empty($type)) {
      $data['attributes']['lc']['input'] = 'text';
      $element = [
        '#type' => 'textfield',
      ];
    }
    return $this->getElement($data, $element);
  }

  /**
   * Provide the processed element textarea.
   *
   * @param array $data
   *   The default values.
   */
  public function plainTextArea(array $data) {
    $element = [
      '#type' => 'textarea',
      '#rows' => $data['rows'],
      '#cols' => $data['cols'],
    ];
    return $this->getElement($data, $element);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc