Skip to content

Commit

Permalink
feat: add $rm->inputfield() helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 20, 2023
1 parent fc1e56f commit c548a78
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions RockMigrations.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,22 @@ public function hideFormFields(InputfieldWrapper $form, $fields)
}
}

/**
* Create inputfield from array syntax
*
* This is handy in combination of $form->insertBefore() or insertAfter()
* and similar methods, because PW unfortunately only supports array syntax
* for $form->add([...]) but not for prepend() append() etc.
*
* @return Inputfield
*/
public function inputfield($data)
{
$fs = $this->wire(new InputfieldWrapper());
$fs->add($data);
return $fs->children()->last();
}

/**
* TRUE = httpHost ends with .ddev.site
* FALSE = httpHost does not end with .ddev.site
Expand Down

0 comments on commit c548a78

Please sign in to comment.