Listings
- fixed selection field JSX - fixed bulk actions (added filter function) - added getPublished/getTrashed static methods on Model - fixed step 3 of newsletter process - updated save/get methods of all listing-able models to conform with the new norm
This commit is contained in:
@@ -71,13 +71,20 @@ class Segments {
|
||||
}
|
||||
|
||||
function save($data = array()) {
|
||||
$result = Segment::createOrUpdate($data);
|
||||
$errors = array();
|
||||
$result = false;
|
||||
|
||||
if($result !== true) {
|
||||
wp_send_json($result);
|
||||
$segment = Segment::createOrUpdate($data);
|
||||
|
||||
if($segment !== false && !$segment->id()) {
|
||||
$errors = $segment->getValidationErrors();
|
||||
} else {
|
||||
wp_send_json(true);
|
||||
$result = true;
|
||||
}
|
||||
wp_send_json(array(
|
||||
'result' => $result,
|
||||
'errors' => $errors
|
||||
));
|
||||
}
|
||||
|
||||
function restore($id) {
|
||||
|
Reference in New Issue
Block a user