From bd138690b316e4f0b3f709d02edf3a3d653f68e0 Mon Sep 17 00:00:00 2001 From: Gabor Juhasz Date: Fri, 15 Sep 2017 19:34:43 +0200 Subject: [PATCH] Allow builder render method to receive extra data --- classes/class-builder.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/class-builder.php b/classes/class-builder.php index e24e1db..0bc47e9 100644 --- a/classes/class-builder.php +++ b/classes/class-builder.php @@ -169,11 +169,17 @@ public function count() { * * @return string The full HTML of the builder and its blocks. */ - public function render() { + public function render($extra = array()) { $this->init(); $out = ''; $of_type = array(); + if (! empty($extra)) { + $this->data = array_map(function($block) use ($extra) { + return array_merge($block, $extra); + }, $this->data); + } + foreach( $this->blocks as $index => $block ) { $simplified = rila_cleanup_class( get_class( $block ), 'Block' ); $simplified = strtolower( $simplified );