mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +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) {
|
||||
$result = $this->wire()->modules->loadModuleFileAssets($this) > 0;
|
||||
if($this->className() === 'InputfieldWrapper') {
|
||||
$result = false;
|
||||
} else {
|
||||
$result = $this->wire()->modules->loadModuleFileAssets($this) > 0;
|
||||
}
|
||||
if($this->wire()->hooks->isMethodHooked($this, 'renderReadyHook')) {
|
||||
$this->renderReadyHook($parent, $renderValueMode);
|
||||
}
|
||||
|
@@ -1182,7 +1182,22 @@ class InputfieldWrapper extends Inputfield implements \Countable, \IteratorAggre
|
||||
$url .= "renderInputfieldAjax=$inputfieldID";
|
||||
$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) {
|
||||
// load assets they will need
|
||||
|
Reference in New Issue
Block a user