mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Some minor fixes to enable deleting a field that is missing its Fieldtype module. Plus addition of hasPage property to Inputfield modules. And a couple other minor things.
This commit is contained in:
@@ -813,6 +813,7 @@ 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('hasPage', $page);
|
||||
|
||||
// custom field settings
|
||||
foreach($this->data as $key => $value) {
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -678,6 +678,8 @@ class Fields extends WireSaveableItems {
|
||||
'getPageIDs' => false,
|
||||
);
|
||||
|
||||
if(!$field->type) return 0;
|
||||
|
||||
$options = array_merge($defaults, $options);
|
||||
$database = $this->wire('database');
|
||||
$table = $database->escapeTable($field->getTable());
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user