Skip to content

Instantly share code, notes, and snippets.

@ijy
Last active December 21, 2015 14:19
Show Gist options
  • Select an option

  • Save ijy/6318986 to your computer and use it in GitHub Desktop.

Select an option

Save ijy/6318986 to your computer and use it in GitHub Desktop.
A Symphony Event (for 2.3x) which looks at the query string produced from a front-end form submission using a GET request and for any keys which have multiple values it wraps them up into a single XML element in the parameter pool for use within datasources. The numeric ones are left in place.
<?php
require_once(TOOLKIT.'/class.event.php');
Class eventmerge_get_param_arrays extends Event {
public $eParamFILTERS = array(
);
public static function about() {
return array(
'name' =>'Merge $_GET param arrays',
'author' => array(
'name' => 'Ian Young',
'website' => 'http://',
'email' => 'i.young@me.com'
),
'version' => '0.1',
'release-date' => '2013-08-23'
);
}
public static function allowEditorToParse() {
return false;
}
public static function documentation() {
return '';
}
public function load() {
$trigger = false;
foreach($_GET as $getParam) {
if (is_array($getParam)) $trigger = true;
}
if ($trigger) return $this -> __trigger();
}
protected function __trigger(){
$page = Frontend::instance()->Page();
if(is_array($_GET) && !empty($_GET)){
foreach($_GET as $key => $value) {
if(is_array($value)){
$page->_param['url-'.$key] = join(',', $value);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment