Version: current

     1 <?php
     2 /*
     3  * Расширение для HtmlEditorField_Toolbar для запрета загрузки файлов при привышении квоты
     4  *
     5  * @author menedem
     6  */
     7
     8 class HtmlEditorQuotaExtension extends Extension {
     9     function extraStatics() {
    10     }
    11
    12     function updateImageForm(& $form) {
    13         $sizeInfo = LeftAndMainQuota::sizeStatus();
    14         if ($sizeInfo->Blocked) {
    15             $form->Fields()->removeByName('ShowUpload');
    16             $form->Fields()->removeByName('Files[0]');
    17             $form->Fields()->removeByName('Response');
    18             $form->Fields()->removeByName('UploadMode');
    19
    20             $form->Fields()->insertAfter(new LiteralField('ShowUpload', '<p class="showUploadField"><a href="#" class="uploadDisable">'. _t('HtmlEditorField.UPLOADDISABLE', 'UPLOAD DISABLE') .'</a></p>'), 'FolderID');
    21
    22         //  debug::show($form->Fields());
    23
    24             //$form->Fields()->insertAfter(new LiteralField('Quota', '<div id="QuotaExceded">'._t('HtmlEditorField.QuotaExceded', 'Quota Exceded').'</div>'), 'FolderID');
    25         }
    26     }
    27 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -