pattern_library-8.x-2.x-dev/src/Plugin/PatternModifierType/Textarea.php

src/Plugin/PatternModifierType/Textarea.php
<?php

namespace Drupal\pattern_library\Plugin\PatternModifierType;

use Drupal\pattern_library\Annotation\PatternModifierType;
use Drupal\pattern_library\Plugin\PatternModifierTypeBase;
use Drupal\pattern_library\Plugin\PatternModifierTypeInterface;

/**
 * Define the pattern textarea modifier type.
 *
 * @PatternModifierType(
 *   id = "textarea"
 * )
 */
class Textarea extends PatternModifierTypeBase implements PatternModifierTypeInterface {

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      '#type' => 'textarea',
    ] + parent::render();
  }

  /**
   * {@inheritDoc}
   */
  public static function transformValue($value) {
    return explode("\r\n", $value);
  }

  /**
   * {@inheritdoc}
   */
  protected function defaultConfiguration() {
    return [
      'description' => 'Input multiple values to use for the modifiers.'
    ];
  }
}

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

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