Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: roadmap-entry for getUpdateOnLoadCode #15

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/UI/Implementation/Component/Input/Field/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,29 @@ final public function getContent() {
*/
public function getUpdateOnLoadCode(): \Closure
{
// TODO: Implement getUpdateOnLoadCode() method for each input if needed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
// TODO: This method will need to be removed.
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This exception will need to be removed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
return $this->withTriggeredSignal($signal, 'update');
}

Expand All @@ -496,6 +511,14 @@ public function withOnUpdate(Signal $signal)
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This exception will need to be removed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
return $this->appendTriggeredSignal($signal, 'update');
}
}
19 changes: 19 additions & 0 deletions src/UI/Implementation/Component/Input/Field/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,23 @@ public function getUpdateOnLoadCode(): \Closure
};
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->withTriggeredSignal($signal, 'update');
}

/**
* @inheritdoc
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->appendTriggeredSignal($signal, 'update');
}
}
20 changes: 20 additions & 0 deletions src/UI/Implementation/Component/Input/Field/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,24 @@ public function getUpdateOnLoadCode(): \Closure
return $code;
};
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->withTriggeredSignal($signal, 'update');
}

/**
* @inheritdoc
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->appendTriggeredSignal($signal, 'update');
}
}
17 changes: 17 additions & 0 deletions src/UI/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ to construct a new Counter.
It would be handy to have a "withNumber"-mutator, or something like
"withIncrease/withDecrease"

### Implement `Input::getUpdateOnLoadCode`, `Input::withOnUpdate` and `Input::appendOnUpdate` for every Input (advanced, ~4h)

When introducing [UI Filters](https://github.com/ILIAS-eLearning/ILIAS/pull/1735)
some ends have been left open and need to be implemented properly. Currently
`withOnUpdate` and `appendOnUpdate` do not work on Inputs in the general case and
only work for `Select Field` and `Text Field` in the context of the filter. To
let the promise of `OnUpdate` come true, the following things will need to be done:

* Every Input needs to implement `Input::getUpdateOnLoadCode`.
* Once this is done, the method `Input::getUpdateOnLoadCode` on the base class
should be removed to force new inputs to implement this method properly.
* The usage of the method should be moved from the (specific) `Container\Filter\Renderer`
to the (general) `Field\Renderer` to make `OnUpdate` apply everywhere.
* `Input::withOnUpdate` and `Input::appendOnUpdate` can then be reinstated on the
base class and removed on `Field\Select` and `Field\Text`.

New inputs must already implement the methods.

## Long Term

Expand Down