public function AmpFormTrait::validHeight in Accelerated Mobile Pages (AMP) 8.3
Limit the height based on the layout.
Parameters
integer $height: The potential value.
Return value
string Either the value or 'auto' if the value is not applicable.
See also
https://www.ampproject.org/docs/design/responsive/control_layout#the-lay...
5 calls to AmpFormTrait::validHeight()
- AmpFormTrait::heightError in src/
AmpFormTrait.php - See if selected height is invalid based on the selected layout.
- AmpImageCarousel::viewElements in src/
Plugin/ Field/ FieldFormatter/ AmpImageCarousel.php - Builds a renderable array for a field value.
- AmpImageFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ AmpImageFormatter.php - Builds a renderable array for a field value.
- AmpSocialPostFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ AmpSocialPostFormatter.php - Builds a renderable array for a field value.
- AmpVideoFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ AmpVideoFormatter.php - Builds a renderable array for a field value.
File
- src/
AmpFormTrait.php, line 223
Class
- AmpFormTrait
- AMP Form trait.
Namespace
Drupal\ampCode
public function validHeight($height, $layout) {
if (empty($height)) {
return 'auto';
}
switch ($layout) {
case 'fixed':
case 'fixed-height':
case 'intrinsic':
case 'responsive':
return $height;
default:
return 'auto';
}
}