From 2d9077d11c4eafa8bf7d2597f4cdcff71ab029b2 Mon Sep 17 00:00:00 2001 From: Richard Klees Date: Tue, 18 Jul 2017 09:39:43 +0200 Subject: [PATCH] UI: removed AbstractComponentRenderer::createId --- .../Render/AbstractComponentRenderer.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/UI/Implementation/Render/AbstractComponentRenderer.php b/src/UI/Implementation/Render/AbstractComponentRenderer.php index fc3d95479566..8bf714a2fe7b 100644 --- a/src/UI/Implementation/Render/AbstractComponentRenderer.php +++ b/src/UI/Implementation/Render/AbstractComponentRenderer.php @@ -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( @@ -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}', { @@ -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.