Devise\Pages\Fields\Handlers\VideoFieldUpdated::buildSettings PHP Method

buildSettings() protected method

Build out the array of settings for the video encoding
protected buildSettings ( Field $field, array $input ) : array
$field Field
$input array
return array
    protected function buildSettings($field, $input)
    {
        $settings = array();
        foreach ($this->formats as $format) {
            $url = isset($field->values->{$format}) && $field->values->{$format} ? $this->filename($field->values, $format) : '';
            $audioEncoding = $field->values->audioEncoding('acc');
            $width = $field->values->width(false);
            $height = $field->values->height(false);
            $upscale = $field->values->upscale(false);
            $aspectMode = $field->values->aspectMode('preserve');
            $size = "{$width}x{$height}";
            if ($url) {
                $newSetting = array('format' => $format, 'label' => $url, 'audio_codec' => $audioEncoding);
                if ($width || $height) {
                    $newSetting['aspect_mode'] = $aspectMode;
                }
                if ($width) {
                    $newSetting['width'] = $width;
                }
                if ($height) {
                    $newSetting['height'] = $height;
                }
                if ($upscale) {
                    $newSetting['upscale'] = true;
                }
                $settings[] = $newSetting;
            }
        }
        return $settings;
    }