{% import "_includes/forms" as forms %} {{ forms.textField({ label: "Project Id"|t('app'), id: 'projectId', name: 'projectId', value: volume.projectId, errors: volume.getErrors('projectId'), class: 'google-project-id', instructions: 'Your Google project id.'|t('app'), required: true }) }} {{ forms.textareaField({ label: "Contents of the access key file"|t('app'), id: 'keyFileContents', name: 'keyFileContents', value: volume.keyFileContents, errors: volume.getErrors('keyFileContents'), class: 'google-key-file-contents', instructions: 'You can leave this field empty if you are using Application default credentials.'|t('app', {'link': 'https://github.com/google/google-auth-library-php#application-default-credentials'}), rows: 8, cols: 50 }) }} {% set bucketInput %}
{{ forms.select({ id: 'bucket', name: 'bucket', options: { (volume.bucket): volume.bucket }, value: volume.bucket, readonly: true, class: 'google-bucket-select' }) }}
{{ "Refresh"|t('app') }}
{% endset %} {{ forms.field({ label: "Bucket"|t('app'), id: 'bucket' }, bucketInput) }} {{ forms.textField({ label: "Subfolder"|t('app'), instructions: "If you want to use a bucket’s subfolder as a Volume, specify the path to use here."|t('app'), id: 'subfolder', class: 'ltr', name: 'subfolder', value: volume.subfolder, errors: volume.getErrors('subfolder'), required: false, placeholder: "path/to/subfolder"|t('app') }) }}
{% set cacheInput %} {% set expires = (volume.expires|length > 0 ? volume.expires|split(' ') : ['', ''])%}
{{ forms.textField({ id: 'expiresAmount', value: expires[0], size: 2, class: 'expires-amount' }) }} {{ forms.select({ id: 'expiresPeriod', options: periods, value: expires[1], class: 'expires-period' }) }}
{{ forms.hidden({ name: "expires", value: volume.expires, class: "expires-combined" }) }} {% endset %} {{ forms.field({ label: "Cache Duration"|t, instructions: "The Cache-Control duration that assets should be uploaded to the cloud with.", id: 'cacheDuration', }, cacheInput) }} {% do view.registerAssetBundle("craft\\googlecloud\\GoogleCloudBundle") %}