1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Fix issue processwire/processwire-issues#24 findPagesSelector containing "=page.id" when used outside original intended context, fix ensures it continues to work without dependent selects

This commit is contained in:
Ryan Cramer
2016-10-06 10:41:59 -04:00
parent cb3e8f741b
commit ba44b4bf20

View File

@@ -365,7 +365,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
$value = null;
if($form && (!$subfield || $subfield == 'id')) {
// attempt to get value from the form, to account for ajax changes that would not yet be reflected on the page
$in = $form->get($field);
$in = $form->getChildByName($field);
if($in) $value = $in->attr('value');
}
if(is_null($value)) $value = $page->get($field);
@@ -374,6 +374,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
$selector = str_replace($tag, "=$value", $selector);
}
}
return $selector;
}
@@ -469,7 +470,10 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
}
if($template_id) $inputfield->template_id = $template_id;
if($findPagesSelector) $inputfield->findPagesSelector = $findPagesSelector;
if($findPagesSelector) {
$inputfield->findPagesSelector = self::getFindPagesSelector($page, $findPagesSelector);
}
if(strlen($labelFieldFormat) && $labelFieldName === '.') {
$inputfield->labelFieldName = $labelFieldFormat;