Skip to content

Commit

Permalink
UI: removed AbstractComponentRenderer::createId
Browse files Browse the repository at this point in the history
  • Loading branch information
klees committed Jul 18, 2017
1 parent 10da635 commit 2d9077d
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/UI/Implementation/Render/AbstractComponentRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function bindOnloadCode(JavaScriptBindable $component) {
if ($binder === null) {
return null;
}
$id = $this->createId();
$id = $this->js_binding->createId();
$on_load_code = $binder($id);
if (!is_string($on_load_code)) {
throw new \LogicException(
Expand All @@ -146,11 +146,12 @@ private function addTriggererOnLoadCode(Triggerer $triggerer) {
return $triggerer;
}
return $triggerer->withAdditionalOnLoadCode(function($id) use ($triggered_signals) {
$code = "";
foreach ($triggered_signals as $triggered_signal) {
$signal = $triggered_signal->getSignal();
$event = $triggered_signal->getEvent();
$options = json_encode($signal->getOptions());
$this->js_binding->addOnLoadCode(
$code .=
"$('#{$id}').{$event}( function(event) {
$(this).trigger('{$signal}',
{
Expand All @@ -160,21 +161,12 @@ private function addTriggererOnLoadCode(Triggerer $triggerer) {
}
);
return false;
});");
});";
}
return $code;
});
}

/**
* Create an ID
*
* @return string
*/
final protected function createId() {
$id = $this->js_binding->createId();
return $id;
}

/**
* Check if a given component fits this renderer and throw \LogicError if that is not
* the case.
Expand Down

0 comments on commit 2d9077d

Please sign in to comment.