|
@@ 509-551 (lines=43) @@
|
| 506 |
|
* @param Entry $entry |
| 507 |
|
* @return XMLElement |
| 508 |
|
*/ |
| 509 |
|
protected function processPostSaveFilters(XMLElement $result, array $fields, Entry $entry = null) |
| 510 |
|
{ |
| 511 |
|
/** |
| 512 |
|
* After saving entry from the front-end. This delegate will not force |
| 513 |
|
* the Events to terminate if it populates the `$filter_results` array. |
| 514 |
|
* Provided with references to this object, the `$_POST` data and also |
| 515 |
|
* the error array |
| 516 |
|
* |
| 517 |
|
* @delegate EventPostSaveFilter |
| 518 |
|
* @param string $context |
| 519 |
|
* '/frontend/' |
| 520 |
|
* @param integer $entry_id |
| 521 |
|
* @param array $fields |
| 522 |
|
* @param Entry $entry |
| 523 |
|
* @param Event $this |
| 524 |
|
* @param array $messages |
| 525 |
|
* An associative array of array's which contain 4 values, |
| 526 |
|
* the name of the filter (string), the status (boolean), |
| 527 |
|
* the message (string) an optionally an associative array |
| 528 |
|
* of additional attributes to add to the filter element. |
| 529 |
|
*/ |
| 530 |
|
Symphony::ExtensionManager()->notifyMembers('EventPostSaveFilter', '/frontend/', array( |
| 531 |
|
'entry_id' => $entry->get('id'), |
| 532 |
|
'fields' => $fields, |
| 533 |
|
'entry' => $entry, |
| 534 |
|
'event' => &$this, |
| 535 |
|
'messages' => &$this->filter_results |
| 536 |
|
)); |
| 537 |
|
|
| 538 |
|
if (is_array($this->filter_results) && !empty($this->filter_results)) { |
| 539 |
|
foreach ($this->filter_results as $fr) { |
| 540 |
|
list($name, $status, $message, $attributes) = $fr; |
| 541 |
|
|
| 542 |
|
$result->appendChild( |
| 543 |
|
self::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes) |
| 544 |
|
); |
| 545 |
|
} |
| 546 |
|
} |
| 547 |
|
|
| 548 |
|
// Reset the filter results to prevent duplicates. RE: #2179 |
| 549 |
|
$this->filter_results = array(); |
| 550 |
|
return $result; |
| 551 |
|
} |
| 552 |
|
|
| 553 |
|
/** |
| 554 |
|
* Processes all extensions attached to the `EventFinalSaveFilter` delegate |
|
@@ 563-612 (lines=50) @@
|
| 560 |
|
* @param Entry $entry |
| 561 |
|
* @return XMLElement |
| 562 |
|
*/ |
| 563 |
|
protected function processFinalSaveFilters(XMLElement $result, array $fields, Entry $entry = null) |
| 564 |
|
{ |
| 565 |
|
/** |
| 566 |
|
* This delegate that lets extensions know the final status of the |
| 567 |
|
* current Event. It is triggered when everything has processed correctly. |
| 568 |
|
* The `$messages` array contains the results of the previous filters that |
| 569 |
|
* have executed, and the `$errors` array contains any errors that have |
| 570 |
|
* occurred as a result of this delegate. These errors cannot stop the |
| 571 |
|
* processing of the Event, as that has already been done. |
| 572 |
|
* |
| 573 |
|
* |
| 574 |
|
* @delegate EventFinalSaveFilter |
| 575 |
|
* @param string $context |
| 576 |
|
* '/frontend/' |
| 577 |
|
* @param array $fields |
| 578 |
|
* @param Event $this |
| 579 |
|
* @param array $messages |
| 580 |
|
* An associative array of array's which contain 4 values, |
| 581 |
|
* the name of the filter (string), the status (boolean), |
| 582 |
|
* the message (string) an optionally an associative array |
| 583 |
|
* of additional attributes to add to the filter element. |
| 584 |
|
* @param array $errors |
| 585 |
|
* An associative array of array's which contain 4 values, |
| 586 |
|
* the name of the filter (string), the status (boolean), |
| 587 |
|
* the message (string) an optionally an associative array |
| 588 |
|
* of additional attributes to add to the filter element. |
| 589 |
|
* @param Entry $entry |
| 590 |
|
*/ |
| 591 |
|
Symphony::ExtensionManager()->notifyMembers('EventFinalSaveFilter', '/frontend/', array( |
| 592 |
|
'fields' => $fields, |
| 593 |
|
'event' => $this, |
| 594 |
|
'messages' => $this->filter_results, |
| 595 |
|
'errors' => &$this->filter_errors, |
| 596 |
|
'entry' => $entry |
| 597 |
|
)); |
| 598 |
|
|
| 599 |
|
if (is_array($this->filter_errors) && !empty($this->filter_errors)) { |
| 600 |
|
foreach ($this->filter_errors as $fr) { |
| 601 |
|
list($name, $status, $message, $attributes) = $fr; |
| 602 |
|
|
| 603 |
|
$result->appendChild( |
| 604 |
|
self::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes) |
| 605 |
|
); |
| 606 |
|
} |
| 607 |
|
} |
| 608 |
|
|
| 609 |
|
// Reset the filter results to prevent duplicates. RE: #2179 |
| 610 |
|
$this->filter_results = array(); |
| 611 |
|
return $result; |
| 612 |
|
} |
| 613 |
|
|
| 614 |
|
/** |
| 615 |
|
* This function handles the Send Mail filter which will send an email |