← All changes
|
includes/Frontend/Form/View/Conversational/Fields/FileUploadField.php
+57
-46
2.10.0
→
3.3.1
View file →
| @@ -19,8 +19,10 @@ | ||
| 19 | 19 | $prefixIcn = $fh->icon('prefixIcn', 'pre-i'); |
| 20 | 20 | $suffixIcn = $fh->icon('suffixIcn', 'suf-i'); |
| 21 | 21 | $name = $fh->name(); |
| 22 | 22 | $req = $fh->required(); |
| 23 | + $ariaDescribedBy = $fh->ariaDescribedBy(); | |
| 24 | + $ariaRequired = $fh->ariaRequired(); | |
| 23 | 25 | $readonlyCls = isset($field->readonly) ? 'readonly' : ''; |
| 24 | 26 | $disabledCls = isset($field->disabled) ? 'disabled' : ''; |
| 25 | 27 | $btnTxt = isset($field->btnTxt) ? $field->btnTxt : ''; |
| 26 | 28 | $showSelectStatus = ''; |
| @@ -30,16 +32,20 @@ | ||
| 30 | 32 | $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds; |
| 31 | 33 | $contentCount = count($bfFrontendFormIds); |
| 32 | 34 | |
| 33 | 35 | if ($fh->property_exists_nested($field, 'config->showSelectStatus', true)) { |
| 34 | - $showSelectStatus = <<<SHOWSELSTATUS | |
| 35 | - <div | |
| 36 | - {$fh->getCustomAttributes('file-select-status')} | |
| 37 | - class="{$fh->getConversationalMultiCls('file-select-status')} {$fh->getCustomClasses('file-select-status')}" | |
| 38 | - > | |
| 39 | - No Choosen File | |
| 40 | - </div> | |
| 41 | -SHOWSELSTATUS; | |
| 36 | + $showSelectStatus = sprintf( | |
| 37 | + '<div | |
| 38 | + %1$s | |
| 39 | + class="%2$s %3$s" | |
| 40 | + > | |
| 41 | + No Choosen File | |
| 42 | + </div> | |
| 43 | +', | |
| 44 | + $fh->getCustomAttributes('file-select-status'), | |
| 45 | + $fh->getConversationalMultiCls('file-select-status'), | |
| 46 | + $fh->getCustomClasses('file-select-status') | |
| 47 | + ); | |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | if ( |
| 45 | 51 | $fh->property_exists_nested($field, 'config->allowMaxSize', true) |
| @@ -47,70 +53,75 @@ | ||
| 47 | 53 | && $fh->property_exists_nested($field, 'config->maxSize') |
| 48 | 54 | && 0 !== $field->config->maxSize |
| 49 | 55 | ) { |
| 50 | 56 | $maxSizeLbl = $fh->property_exists_nested($field, 'config->maxSizeLabel', '', 1) ? $field->config->maxSizeLabel : "(Max {$maxSize} ${sizeUnit})"; |
| 51 | - $maxSizeSection = <<<MAXSIZE | |
| 52 | - <small | |
| 53 | - {$fh->getCustomAttributes('max-size-lbl')} | |
| 54 | - class="{$fh->getConversationalMultiCls('max-size-lbl')} {$fh->getCustomClasses('max-size-lbl')}" | |
| 55 | - > | |
| 56 | - {$fh->esc_html($maxSizeLbl)} | |
| 57 | - </small> | |
| 58 | -MAXSIZE; | |
| 57 | + $maxSizeSection = sprintf( | |
| 58 | + '<small | |
| 59 | + %1$s | |
| 60 | + class="%2$s %3$s" | |
| 61 | + > | |
| 62 | + %4$s | |
| 63 | + </small> | |
| 64 | +', | |
| 65 | + $fh->getCustomAttributes('max-size-lbl'), | |
| 66 | + $fh->getConversationalMultiCls('max-size-lbl'), | |
| 67 | + $fh->getCustomClasses('max-size-lbl'), | |
| 68 | + $fh->esc_html($maxSizeLbl) | |
| 69 | + ); | |
| 59 | 70 | } |
| 60 | 71 | |
| 61 | - return <<<FILEUPLOADFIELD | |
| 62 | - <div | |
| 63 | - {$fh->getCustomAttributes('file-up-container')} | |
| 64 | - class="{$fh->getConversationalMultiCls('file-up-container')} {$fh->getCustomClasses('file-up-container')}" | |
| 72 | + return ' <div | |
| 73 | + ' . $fh->getCustomAttributes('file-up-container') . ' | |
| 74 | + class="' . $fh->getConversationalMultiCls('file-up-container') . ' ' . $fh->getCustomClasses('file-up-container') . '" | |
| 65 | 75 | > |
| 66 | 76 | <div |
| 67 | - {$fh->getCustomAttributes('file-up-wrpr')} | |
| 68 | - class="{$fh->getConversationalMultiCls('file-up-wrpr')} {$fh->getCustomClasses('file-up-wrpr')} {$readonlyCls} {$disabledCls}" | |
| 77 | + ' . $fh->getCustomAttributes('file-up-wrpr') . ' | |
| 78 | + class="' . $fh->getConversationalMultiCls('file-up-wrpr') . ' ' . $fh->getCustomClasses('file-up-wrpr') . ' ' . $readonlyCls . ' ' . $disabledCls . '" | |
| 69 | 79 | > |
| 70 | 80 | <div |
| 71 | - {$fh->getCustomAttributes('file-input-wrpr')} | |
| 72 | - class="{$fh->getConversationalMultiCls('file-input-wrpr')} {$fh->getCustomClasses('file-input-wrpr')}" | |
| 81 | + ' . $fh->getCustomAttributes('file-input-wrpr') . ' | |
| 82 | + class="' . $fh->getConversationalMultiCls('file-input-wrpr') . ' ' . $fh->getCustomClasses('file-input-wrpr') . '" | |
| 73 | 83 | > |
| 74 | 84 | <div |
| 75 | - {$fh->getCustomAttributes('btn-wrpr')} | |
| 76 | - class="{$fh->getConversationalMultiCls('btn-wrpr')} {$fh->getCustomClasses('btn-wrpr')}" | |
| 85 | + ' . $fh->getCustomAttributes('btn-wrpr') . ' | |
| 86 | + class="' . $fh->getConversationalMultiCls('btn-wrpr') . ' ' . $fh->getCustomClasses('btn-wrpr') . '" | |
| 77 | 87 | > |
| 78 | 88 | <button |
| 79 | - {$fh->getCustomAttributes('inp-btn')} | |
| 89 | + ' . $fh->getCustomAttributes('inp-btn') . ' | |
| 80 | 90 | type="button" |
| 81 | - class="{$fh->getConversationalMultiCls('inp-btn')} {$fh->getCustomClasses('inp-btn')}" | |
| 91 | + class="' . $fh->getConversationalMultiCls('inp-btn') . ' ' . $fh->getCustomClasses('inp-btn') . '" | |
| 82 | 92 | > |
| 83 | - {$prefixIcn} | |
| 93 | + ' . $prefixIcn . ' | |
| 84 | 94 | <span |
| 85 | - {$fh->getCustomAttributes('btn-txt')} | |
| 86 | - class="{$fh->getConversationalMultiCls('btn-txt')} {$fh->getCustomClasses('btn-txt')}" | |
| 95 | + ' . $fh->getCustomAttributes('btn-txt') . ' | |
| 96 | + class="' . $fh->getConversationalMultiCls('btn-txt') . ' ' . $fh->getCustomClasses('btn-txt') . '" | |
| 87 | 97 | > |
| 88 | - {$fh->kses_post($btnTxt)} | |
| 98 | + ' . $fh->kses_post($btnTxt) . ' | |
| 89 | 99 | </span> |
| 90 | - {$suffixIcn} | |
| 100 | + ' . $suffixIcn . ' | |
| 91 | 101 | </button> |
| 92 | - {$showSelectStatus} | |
| 93 | - {$maxSizeSection} | |
| 102 | + ' . $showSelectStatus . ' | |
| 103 | + ' . $maxSizeSection . ' | |
| 94 | 104 | <input |
| 95 | - {$fh->getCustomAttributes('file-upload-input')} | |
| 105 | + ' . $fh->getCustomAttributes('file-upload-input') . ' | |
| 96 | 106 | type="file" |
| 97 | - class="{$fh->getConversationalMultiCls('file-upload-input')} {$fh->getCustomClasses('file-upload-input')}" | |
| 98 | - id="{$rowID}-{$contentCount}" | |
| 99 | - {$name} | |
| 100 | - {$req} | |
| 101 | - {$fh->disabled()} | |
| 102 | - {$fh->readonly()} | |
| 107 | + class="' . $fh->getConversationalMultiCls('file-upload-input') . ' ' . $fh->getCustomClasses('file-upload-input') . '" | |
| 108 | + id="' . $rowID . '-' . $contentCount . '" | |
| 109 | + ' . $name . ' | |
| 110 | + ' . $req . ' | |
| 111 | + ' . $ariaRequired . ' | |
| 112 | + ' . $ariaDescribedBy . ' | |
| 113 | + ' . $fh->disabled() . ' | |
| 114 | + ' . $fh->readonly() . ' | |
| 103 | 115 | aria-disabled="true" |
| 104 | 116 | tabindex="-1" |
| 105 | 117 | /> |
| 106 | 118 | </div> |
| 107 | 119 | <div |
| 108 | - {$fh->getCustomAttributes('err-wrp')} | |
| 109 | - class="err-wrp {$fh->getCustomClasses('err-wrp')}" | |
| 120 | + ' . $fh->getCustomAttributes('err-wrp') . ' | |
| 121 | + class="err-wrp ' . $fh->getCustomClasses('err-wrp') . '" | |
| 110 | 122 | ></div> |
| 111 | 123 | </div> |
| 112 | 124 | </div> |
| 113 | - </div> | |
| 114 | -FILEUPLOADFIELD; | |
| 125 | + </div>'; | |
| 115 | 126 | } |
| 116 | 127 | } |