mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Update Inputfield class so that dependencies can be supported on many ajax-loaded Inputfields before they are… ajax-loaded.
This commit is contained in:
@@ -1467,7 +1467,11 @@ abstract class Inputfield extends WireData implements Module {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function renderReady(Inputfield $parent = null, $renderValueMode = false) {
|
public function renderReady(Inputfield $parent = null, $renderValueMode = false) {
|
||||||
|
if($this->className() === 'InputfieldWrapper') {
|
||||||
|
$result = false;
|
||||||
|
} else {
|
||||||
$result = $this->wire()->modules->loadModuleFileAssets($this) > 0;
|
$result = $this->wire()->modules->loadModuleFileAssets($this) > 0;
|
||||||
|
}
|
||||||
if($this->wire()->hooks->isMethodHooked($this, 'renderReadyHook')) {
|
if($this->wire()->hooks->isMethodHooked($this, 'renderReadyHook')) {
|
||||||
$this->renderReadyHook($parent, $renderValueMode);
|
$this->renderReadyHook($parent, $renderValueMode);
|
||||||
}
|
}
|
||||||
|
@@ -1182,7 +1182,22 @@ class InputfieldWrapper extends Inputfield implements \Countable, \IteratorAggre
|
|||||||
$url .= "renderInputfieldAjax=$inputfieldID";
|
$url .= "renderInputfieldAjax=$inputfieldID";
|
||||||
$url = $sanitizer->entities($url);
|
$url = $sanitizer->entities($url);
|
||||||
|
|
||||||
$out = "<div class='renderInputfieldAjax'><input type='hidden' value='$url' /></div>";
|
$valueInput = '';
|
||||||
|
$val = $inputfield->val();
|
||||||
|
if(!is_array($val) && !is_object($val)) {
|
||||||
|
$val = (string) $val;
|
||||||
|
if(strlen("$val") <= 1024) {
|
||||||
|
// keep value in hidden input so dependences can refer to it
|
||||||
|
$val = $sanitizer->entities("$val");
|
||||||
|
$valueInput = "<input type='hidden' id='$inputfieldID' value='$val' />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$out =
|
||||||
|
"<div class='renderInputfieldAjax'>" .
|
||||||
|
"<input type='hidden' value='$url' />" .
|
||||||
|
$valueInput .
|
||||||
|
"</div>";
|
||||||
|
|
||||||
if($inputfield instanceof InputfieldWrapper) {
|
if($inputfield instanceof InputfieldWrapper) {
|
||||||
// load assets they will need
|
// load assets they will need
|
||||||
|
@@ -182,6 +182,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
$class = 'ui-autocomplete-input ' . ($this->useList ? 'has_list' : 'no_list');
|
$class = 'ui-autocomplete-input ' . ($this->useList ? 'has_list' : 'no_list');
|
||||||
if($this->useAndWords) $class .= " and_words";
|
if($this->useAndWords) $class .= " and_words";
|
||||||
if($this->allowAnyValue) $class .= " allow_any";
|
if($this->allowAnyValue) $class .= " allow_any";
|
||||||
|
$class = trim($sanitizer->entities("$class " . $this->attr('class')));
|
||||||
|
|
||||||
$disableChars = $this->disableChars;
|
$disableChars = $this->disableChars;
|
||||||
if($disableChars) {
|
if($disableChars) {
|
||||||
|
Reference in New Issue
Block a user