public function AmpFormTrait::validWidth in Accelerated Mobile Pages (AMP) 8.3
Limit the width based on the layout.
Parameters
integer $width: 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::validWidth()
- AmpFormTrait::widthError in src/
AmpFormTrait.php - See if selected width 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 160
Class
- AmpFormTrait
- AMP Form trait.
Namespace
Drupal\ampCode
public function validWidth($width, $layout) {
if (empty($width)) {
return 'auto';
}
switch ($layout) {
case 'fixed':
case 'intrinsic':
case 'responsive':
return $width;
default:
return 'auto';
}
}