DirectorObjectForm: hidden id field, start...

...fading it out - don't want to see this here
This commit is contained in:
Thomas Gelf 2021-10-05 22:57:09 +02:00
parent 2e069ef127
commit c994610031
3 changed files with 6 additions and 13 deletions

View File

@ -19,17 +19,11 @@ class DatafieldController extends ActionController
public function indexAction() public function indexAction()
{ {
$edit = false;
if ($id = $this->params->get('id')) {
$edit = true;
}
$form = DirectorDatafieldForm::load() $form = DirectorDatafieldForm::load()
->setDb($this->db()); ->setDb($this->db());
if ($edit) { if ($id = $this->params->get('id')) {
$form->loadObject($id); $form->loadObject((int) $id);
$this->addTitle( $this->addTitle(
$this->translate('Modify %s'), $this->translate('Modify %s'),
$form->getObject()->varname $form->getObject()->varname

View File

@ -284,7 +284,7 @@ class ImportsourceController extends ActionController
. (int) $source->get('id'); . (int) $source->get('id');
$this->content()->prepend( $this->content()->prepend(
ImportRowModifierForm::load()->setDb($this->db()) ImportRowModifierForm::load()->setDb($this->db())
->loadObject($this->params->getRequired('id')) ->loadObject((int) $this->params->getRequired('id'))
->setListUrl($listUrl) ->setListUrl($listUrl)
->setSource($source) ->setSource($source)
->handleRequest() ->handleRequest()

View File

@ -1080,14 +1080,13 @@ abstract class DirectorObjectForm extends DirectorForm
$class = $this->getObjectClassname(); $class = $this->getObjectClassname();
if (is_int($id)) { if (is_int($id)) {
$this->object = $class::loadWithAutoIncId($id, $this->db); $this->object = $class::loadWithAutoIncId($id, $this->db);
if ($this->object->getKeyName() === 'id') {
$this->addHidden('id', $id);
}
} else { } else {
$this->object = $class::load($id, $this->db); $this->object = $class::load($id, $this->db);
} }
// TODO: hmmmm...
if (! is_array($id) && $this->object->getKeyName() === 'id') {
$this->addHidden('id', $id);
}
return $this; return $this;
} }