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

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

namespace Drupal\pattern_library\Plugin\PatternModifierType;

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

/**
 * Define the pattern text modifier type.
 *
 * @PatternModifierType(
 *   id = "text"
 * )
 */
class Text extends PatternModifierTypeBase {

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

  /**
   * {@inheritDoc}
   */
  public static function transformValue($value) {
    return [$value];
  }

  /**
   * {@inheritdoc}
   */
  protected function defaultConfiguration() {
    return [
      'description' => 'Input a single value to use as the modifier.'
    ];
  }
}

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

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