diff --git a/wire/core/Field.php b/wire/core/Field.php index 91212a06..d2281e81 100644 --- a/wire/core/Field.php +++ b/wire/core/Field.php @@ -812,7 +812,8 @@ class Field extends WireData implements Saveable, Exportable { // just in case an Inputfield needs to know its Fieldtype/Field context, or lack of it $inputfield->set('hasFieldtype', $this->type); - $inputfield->set('hasField', $this); + $inputfield->set('hasField', $this); + $inputfield->set('hasPage', $page); // custom field settings foreach($this->data as $key => $value) { diff --git a/wire/core/Fieldgroup.php b/wire/core/Fieldgroup.php index a4adc360..984891d1 100644 --- a/wire/core/Fieldgroup.php +++ b/wire/core/Fieldgroup.php @@ -177,7 +177,7 @@ class Fieldgroup extends WireArray implements Saveable, Exportable, HasLookupIte * #pw-internal * * @param Field $field - * @return bool + * @return Fieldgroup $this * */ public function finishRemove(Field $field) { @@ -194,7 +194,7 @@ class Fieldgroup extends WireArray implements Saveable, Exportable, HasLookupIte * #pw-group-manipulation * * @param Field|string|int $field Field object, name or id. - * @return bool + * @return Fieldgroup $this * */ public function softRemove($field) { @@ -612,7 +612,7 @@ class Fieldgroup extends WireArray implements Saveable, Exportable, HasLookupIte if(!$inputfield) continue; if($inputfield->collapsed == Inputfield::collapsedHidden) continue; - $inputfield->value = $page->get($field->name); + $inputfield->setAttribute('value', $page->get($field->name)); if($multiMode) { $fieldInputfields[$field->id] = $inputfield; diff --git a/wire/core/Fieldgroups.php b/wire/core/Fieldgroups.php index cc4bc98d..aa7a7f1c 100644 --- a/wire/core/Fieldgroups.php +++ b/wire/core/Fieldgroups.php @@ -161,7 +161,7 @@ class Fieldgroups extends WireSaveableItemsLookup { throw new WireException("Field '$field' may not be removed from fieldgroup '{$item->name}' because it is permanent."); } - $field->type->deleteTemplateField($template, $field); + if($field->type) $field->type->deleteTemplateField($template, $field); $item->finishRemove($field); } } diff --git a/wire/core/Fields.php b/wire/core/Fields.php index 33263478..484b64d8 100644 --- a/wire/core/Fields.php +++ b/wire/core/Fields.php @@ -677,6 +677,8 @@ class Fields extends WireSaveableItems { 'countPages' => false, 'getPageIDs' => false, ); + + if(!$field->type) return 0; $options = array_merge($defaults, $options); $database = $this->wire('database'); diff --git a/wire/core/Inputfield.php b/wire/core/Inputfield.php index f51e430b..5d708776 100644 --- a/wire/core/Inputfield.php +++ b/wire/core/Inputfield.php @@ -68,7 +68,8 @@ * @property string $requiredIf Optional conditions under which input is required (selector string). #pw-group-behavior * @property InputfieldWrapper|null $parent The parent InputfieldWrapper for this Inputfield or null if not set. #pw-internal * @property null|bool|Fieldtype $hasFieldtype The Fieldtype using this Inputfield, or boolean false when known not to have a Fieldtype, or null when not known. #pw-group-other - * @property null|Field $hasField The Field object associated with this Inputfield, or or null when not applicable or not known. #pw-group-other + * @property null|Field $hasField The Field object associated with this Inputfield, or null when not applicable or not known. #pw-group-other + * @property null|Page $hasPage The Page object associated with this Inputfield, or null when not applicable or not known. #pw-group-other * @property bool|null $useLanguages When multi-language support active, can be set to true to make it provide inputs for each language, where supported (default=false). #pw-group-behavior * @property null|bool|int $entityEncodeLabel Set to boolean false to specifically disable entity encoding of field header/label (default=true). #pw-group-output * @property null|bool $entityEncodeText Set to boolean false to specifically disable entity encoding for other text: description, notes, etc. (default=true). #pw-group-output