|
@@ 672-714 (lines=43) @@
|
| 669 |
|
* @param Entry $entry |
| 670 |
|
* @return XMLElement |
| 671 |
|
*/ |
| 672 |
|
protected function processPostSaveFilters(XMLElement $result, array $fields, Entry $entry = null) |
| 673 |
|
{ |
| 674 |
|
/** |
| 675 |
|
* After saving entry from the front-end. This delegate will not force |
| 676 |
|
* the Events to terminate if it populates the `$filter_results` array. |
| 677 |
|
* Provided with references to this object, the `$_POST` data and also |
| 678 |
|
* the error array |
| 679 |
|
* |
| 680 |
|
* @delegate EventPostSaveFilter |
| 681 |
|
* @param string $context |
| 682 |
|
* '/frontend/' |
| 683 |
|
* @param integer $entry_id |
| 684 |
|
* @param array $fields |
| 685 |
|
* @param Entry $entry |
| 686 |
|
* @param Event $this |
| 687 |
|
* @param array $messages |
| 688 |
|
* An associative array of array's which contain 4 values, |
| 689 |
|
* the name of the filter (string), the status (boolean), |
| 690 |
|
* the message (string) an optionally an associative array |
| 691 |
|
* of additional attributes to add to the filter element. |
| 692 |
|
*/ |
| 693 |
|
Symphony::ExtensionManager()->notifyMembers('EventPostSaveFilter', '/frontend/', array( |
| 694 |
|
'entry_id' => $entry->get('id'), |
| 695 |
|
'fields' => $fields, |
| 696 |
|
'entry' => $entry, |
| 697 |
|
'event' => &$this, |
| 698 |
|
'messages' => &$this->filter_results |
| 699 |
|
)); |
| 700 |
|
|
| 701 |
|
if (is_array($this->filter_results) && !empty($this->filter_results)) { |
| 702 |
|
foreach ($this->filter_results as $fr) { |
| 703 |
|
list($name, $status, $message, $attributes) = $fr; |
| 704 |
|
|
| 705 |
|
$result->appendChild( |
| 706 |
|
self::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes) |
| 707 |
|
); |
| 708 |
|
} |
| 709 |
|
} |
| 710 |
|
|
| 711 |
|
// Reset the filter results to prevent duplicates. RE: #2179 |
| 712 |
|
$this->filter_results = array(); |
| 713 |
|
|
| 714 |
|
return $result; |
| 715 |
|
} |
| 716 |
|
|
| 717 |
|
/** |
|
@@ 727-776 (lines=50) @@
|
| 724 |
|
* @param Entry $entry |
| 725 |
|
* @return XMLElement |
| 726 |
|
*/ |
| 727 |
|
protected function processFinalSaveFilters(XMLElement $result, array $fields, Entry $entry = null) |
| 728 |
|
{ |
| 729 |
|
/** |
| 730 |
|
* This delegate that lets extensions know the final status of the |
| 731 |
|
* current Event. It is triggered when everything has processed correctly. |
| 732 |
|
* The `$messages` array contains the results of the previous filters that |
| 733 |
|
* have executed, and the `$errors` array contains any errors that have |
| 734 |
|
* occurred as a result of this delegate. These errors cannot stop the |
| 735 |
|
* processing of the Event, as that has already been done. |
| 736 |
|
* |
| 737 |
|
* |
| 738 |
|
* @delegate EventFinalSaveFilter |
| 739 |
|
* @param string $context |
| 740 |
|
* '/frontend/' |
| 741 |
|
* @param array $fields |
| 742 |
|
* @param Event $this |
| 743 |
|
* @param array $messages |
| 744 |
|
* An associative array of array's which contain 4 values, |
| 745 |
|
* the name of the filter (string), the status (boolean), |
| 746 |
|
* the message (string) an optionally an associative array |
| 747 |
|
* of additional attributes to add to the filter element. |
| 748 |
|
* @param array $errors |
| 749 |
|
* An associative array of array's which contain 4 values, |
| 750 |
|
* the name of the filter (string), the status (boolean), |
| 751 |
|
* the message (string) an optionally an associative array |
| 752 |
|
* of additional attributes to add to the filter element. |
| 753 |
|
* @param Entry $entry |
| 754 |
|
*/ |
| 755 |
|
Symphony::ExtensionManager()->notifyMembers('EventFinalSaveFilter', '/frontend/', array( |
| 756 |
|
'fields' => $fields, |
| 757 |
|
'event' => $this, |
| 758 |
|
'messages' => $this->filter_results, |
| 759 |
|
'errors' => &$this->filter_errors, |
| 760 |
|
'entry' => $entry |
| 761 |
|
)); |
| 762 |
|
|
| 763 |
|
if (is_array($this->filter_errors) && !empty($this->filter_errors)) { |
| 764 |
|
foreach ($this->filter_errors as $fr) { |
| 765 |
|
list($name, $status, $message, $attributes) = $fr; |
| 766 |
|
|
| 767 |
|
$result->appendChild( |
| 768 |
|
self::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes) |
| 769 |
|
); |
| 770 |
|
} |
| 771 |
|
} |
| 772 |
|
|
| 773 |
|
// Reset the filter results to prevent duplicates. RE: #2179 |
| 774 |
|
$this->filter_results = array(); |
| 775 |
|
|
| 776 |
|
return $result; |
| 777 |
|
} |
| 778 |
|
} |
| 779 |
|
|