mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
IcingaMultiEditForm: use IcingaObjectFormHook
This commit is contained in:
parent
93a882f8c5
commit
da909907fd
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
use Icinga\Module\Director\Data\Db\DbObject;
|
use Icinga\Module\Director\Data\Db\DbObject;
|
||||||
|
use Icinga\Module\Director\Hook\IcingaObjectFormHook;
|
||||||
use Icinga\Module\Director\Web\Form\IcingaObjectFieldLoader;
|
use Icinga\Module\Director\Web\Form\IcingaObjectFieldLoader;
|
||||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
use Icinga\Module\Director\Web\Form\QuickForm;
|
use Icinga\Module\Director\Web\Form\QuickForm;
|
||||||
@ -28,6 +29,11 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isMultiObjectForm()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function pickElementsFrom(QuickForm $form, $properties)
|
public function pickElementsFrom(QuickForm $form, $properties)
|
||||||
{
|
{
|
||||||
$this->relatedForm = $form;
|
$this->relatedForm = $form;
|
||||||
@ -97,6 +103,7 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
|||||||
*/
|
*/
|
||||||
protected function onRequest()
|
protected function onRequest()
|
||||||
{
|
{
|
||||||
|
IcingaObjectFormHook::callOnSetup($this);
|
||||||
if ($this->hasBeenSent()) {
|
if ($this->hasBeenSent()) {
|
||||||
$this->handlePost();
|
$this->handlePost();
|
||||||
}
|
}
|
||||||
@ -104,6 +111,7 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
|||||||
|
|
||||||
protected function handlePost()
|
protected function handlePost()
|
||||||
{
|
{
|
||||||
|
$this->callOnRequestCallables();
|
||||||
if ($this->shouldBeDeleted()) {
|
if ($this->shouldBeDeleted()) {
|
||||||
$this->deleteObjects();
|
$this->deleteObjects();
|
||||||
}
|
}
|
||||||
@ -278,9 +286,14 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
|||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjects($names)
|
public function getObjects($names = null)
|
||||||
{
|
{
|
||||||
|
if ($names === null) {
|
||||||
|
return $this->objects;
|
||||||
|
}
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
|
|
||||||
foreach ($names as $name) {
|
foreach ($names as $name) {
|
||||||
$res[$name] = $this->objects[$name];
|
$res[$name] = $this->objects[$name];
|
||||||
}
|
}
|
||||||
|
@ -688,6 +688,24 @@ abstract class DirectorObjectForm extends DirectorForm
|
|||||||
return $this->object !== null;
|
return $this->object !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isIcingaObject()
|
||||||
|
{
|
||||||
|
if ($this->object !== null) {
|
||||||
|
return $this->object instanceof IcingaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var DbObject $class */
|
||||||
|
$class = $this->getObjectClassname();
|
||||||
|
$instance = $class::create();
|
||||||
|
|
||||||
|
return $instance instanceof IcingaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isMultiObjectForm()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function setObject(DbObject $object)
|
public function setObject(DbObject $object)
|
||||||
{
|
{
|
||||||
$this->object = $object;
|
$this->object = $object;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user