-
-
Save michael-e/3f0f8d5cd1062eb619a6eee5735ffc80 to your computer and use it in GitHub Desktop.
Custom event1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class eventevent1 extends SectionEvent | |
{ | |
public $ROOTELEMENT = 'event1'; | |
public $eParamFILTERS = array( | |
); | |
public static function about() | |
{ | |
return array( | |
'name' => 'event1', | |
'author' => array( | |
'name' => 'Wannes Debusschere', | |
'website' => 'https://xxx', | |
'email' => '[email protected]'), | |
'version' => 'Symphony 2.7.7', | |
'release-date' => '2016-08-01T20:05:17+00:00', | |
'trigger-condition' => 'action[event1]' | |
); | |
} | |
public static function getSource() | |
{ | |
return '6'; | |
} | |
public static function allowEditorToParse() | |
{ | |
return false; //Important | |
} | |
public static function documentation() | |
{ | |
return ' | |
<label>Title<input name="fields[title]" type="text" /></label> //Title for section1 | |
<label>Title<input name="fields[event2][title]" type="text" /></label> //Option1: Title for section2 | |
'; | |
} | |
public function load() | |
{ | |
if (isset($_POST['action']['event1'])) { | |
// return $this->__trigger(); | |
return $this->execute(); | |
} | |
} | |
public function execute() | |
{ | |
$result = parent::execute(); | |
if ($result->getAttribute('result') == "success") | |
{ | |
$id = $result->getAttribute('id'); | |
//Option1: with second event | |
$_POST['event2']['fields']['idfromevent1'] = $id; | |
$_POST['fields'] = $_POST['event2']['fields']; | |
$_POST['action']['event2'] = 'Submit'; | |
//Option2: with SymQl | |
//Option3: with EntryManager | |
} | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment