Skip to content

Instantly share code, notes, and snippets.

@michael-e
Forked from wdebusschere/event.event1.php
Created October 29, 2018 11:48
Show Gist options
  • Save michael-e/3f0f8d5cd1062eb619a6eee5735ffc80 to your computer and use it in GitHub Desktop.
Save michael-e/3f0f8d5cd1062eb619a6eee5735ffc80 to your computer and use it in GitHub Desktop.
Custom event1
<?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