You are here

public function AmpFormTrait::heightElement in Accelerated Mobile Pages (AMP) 8.3

The height form element.

Return value

array A form element.

5 calls to AmpFormTrait::heightElement()
AmpImageCarousel::settingsForm in src/Plugin/Field/FieldFormatter/AmpImageCarousel.php
Returns a form to configure settings for the formatter.
AmpImageFormatter::settingsForm in src/Plugin/Field/FieldFormatter/AmpImageFormatter.php
Returns a form to configure settings for the formatter.
AmpSocialPostFormatter::settingsForm in src/Plugin/Field/FieldFormatter/AmpSocialPostFormatter.php
Returns a form to configure settings for the formatter.
AmpVideoFormatter::settingsForm in src/Plugin/Field/FieldFormatter/AmpVideoFormatter.php
Returns a form to configure settings for the formatter.
AmpViewsCarouselStyle::buildOptionsForm in src/Plugin/views/style/AmpViewsCarouselStyle.php
Provide a form to edit options for this plugin.

File

src/AmpFormTrait.php, line 195

Class

AmpFormTrait
AMP Form trait.

Namespace

Drupal\amp

Code

public function heightElement() {
  $element = [
    '#type' => 'number',
    '#title' => t('Height'),
    '#size' => 10,
    '#default_value' => $this
      ->getSetting('height'),
    '#description' => $this
      ->t('Width of the item in pixels, not percent. With the responsive layout you can set the aspect ratio instead, i.e. width: 16, height: 9.'),
    '#states' => [
      'visible' => [
        [
          $this
            ->layoutSelector() => [
            'value' => 'fixed',
          ],
        ],
        [
          $this
            ->layoutSelector() => [
            'value' => 'fixed-height',
          ],
        ],
        [
          $this
            ->layoutSelector() => [
            'value' => 'intrinsic',
          ],
        ],
        [
          $this
            ->layoutSelector() => [
            'value' => 'responsive',
          ],
        ],
      ],
    ],
  ];
  return $element;
}