Error creating a block with blank view.php (intended for invoking addHeaderItem in the controller only)
Permalink
Hi all
I'm trying to create a block using Designer Content to get values from the user, which will then be inserted as javascript variables using addHeaderItem. The block won't display anything itself - the point is to give the user an obvious place to add in additional data (in this case it's addresses entered into a textarea, with one on each line).
I'm trying to use __construct() in the block's controller to add the requisite javascript:
This seems to work, but I see the following error on the page:
in the area where the 'blank' block is located.
I've tried using on_start() and on_before_render() instead of __construct() in the controller, but they don't fire addHeaderItem() at all.
It's all working except for this error.
Anyone have any ideas?
I'm trying to create a block using Designer Content to get values from the user, which will then be inserted as javascript variables using addHeaderItem. The block won't display anything itself - the point is to give the user an obvious place to add in additional data (in this case it's addresses entered into a textarea, with one on each line).
I'm trying to use __construct() in the block's controller to add the requisite javascript:
public function __construct(){ $addresses = $this->field_1_textarea_text; $this->addHeaderItem(' <script type="text/javascript"> var simple_markers = ["'.$addresses.']; </script>'); }
This seems to work, but I see the following error on the page:
in the area where the 'blank' block is located.
I've tried using on_start() and on_before_render() instead of __construct() in the controller, but they don't fire addHeaderItem() at all.
It's all working except for this error.
Anyone have any ideas?