0

I have create A Image upload field Using UI Component. Now I want to Hide or Delete Button. Any help would be appreciated.

enter image description here

0

For your module you should Create [Namespace][Module]\view\base\web\templates\form\element\uploader\image.html

`

<div class="admin__field-control" css="'_with-tooltip': $data.tooltip">
    <div class="file-uploader image-uploader" data-role="drop-zone" css="_loading: isLoading">
        <div class="file-uploader-area">
            <input type="file" afterRender="onElementRender" attr="id: uid, name: inputName, multiple: isMultipleFiles" disable="disabled" />
            <label class="file-uploader-button action-default" attr="for: uid, disabled: disabled" disable="disabled" translate="'Upload'" />                
            <render args="fallbackResetTpl" if="$data.showFallbackReset && $data.isDifferedFromDefault"/>
            <p class="image-upload-requirements">
                <span if="$data.maxFileSize">
                    <span translate="'Maximum file size'" />: <text args="formatSize($data.maxFileSize)"/>.
                </span>
                <span if="$data.allowedExtensions">
                    <span translate="'Allowed file types'" />: <text args="getAllowedFileExtensionsInCommaDelimitedFormat()"/>.
                </span>
            </p>
        </div>

        <render args="tooltipTpl" if="$data.tooltip"/>

        <div class="admin__field-note" if="$data.notice" attr="id: noticeId">
            <span html="notice"/>
        </div>

        <label class="admin__field-error" if="error" attr="for: uid" text="error"/>

        <each args="data: value, as: '$file'" render="$parent.getPreviewTmpl($file)"/>

        <div if="!hasData()" class="image image-placeholder" click="triggerImageUpload">
            <div class="file-uploader-summary product-image-wrapper">
                <div class="file-uploader-spinner image-uploader-spinner" />
                <p class="image-placeholder-text" translate="'Browse to find or drag image here'"/>
            </div>
        </div>
    </div>
    <render args="$data.service.template" if="$data.hasService()"/>
</div>

`

also in [Namespace]/[Module]/view/frontend/requirejs-config.js add this:

var config = {
    map: {
        '*': {
            'Magento_Ui/templates/form/element/uploader/image.html':'[Namespace]/[Module]/templates/form/element/uploader/image.html'
        }
    }
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.