Tribe__Events__Aggregator__Tabs__Edit::finalize_schedule_edit( Tribe__Events__Aggregator__Record__Abstract $record, array $post_data, array $meta )
Finalizes the saving of a scheduled import
Contents
Parameters
- $record
-
(Tribe__Events__Aggregator__Record__Abstract) (Required) Record object
- $post_data
-
(array) (Required) Massaged POSTed data
- $meta
-
(array) (Required) Meta to be saved to the schedule
Source
File: src/Tribe/Aggregator/Tabs/Edit.php
public function finalize_schedule_edit( $record, $post_data, $meta ) {
$this->messages = array(
'error' => array(),
'success' => array(),
'warning' => array(),
);
$meta['post_status'] = empty( $post_data['post_status'] ) ? 'draft' : $post_data['post_status'];
$meta['category'] = Tribe__Utils__Array::get( $post_data, 'category', null );
$result = $record->save( $post_data['post_id'], array(), $meta );
if ( is_wp_error( $result ) ) {
$this->messages['error'][] = $result->get_error_message();
ob_start();
?>
<p>
<?php echo implode( ' ', $this->messages['error'] ); ?>
</p>
<?php
$html = ob_get_clean();
tribe_notice( 'tribe-aggregator-schedule-edit-failed', $html, 'type=error' );
return $result;
}
$this->messages['success'][] = esc_html__( 'Scheduled import was successfully updated.' );
ob_start();
?>
<p>
<?php echo implode( ' ', $this->messages['success'] ); ?>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=' . Tribe__Events__Main::POSTTYPE . '&page=aggregator&tab=scheduled' ) ); ?>" ><?php esc_html_e( 'View All Scheduled Imports', 'the-events-calendar' ); ?></a>
</p>
<?php
$html = ob_get_clean();
$this->messages['success'][] = __( 'Your Scheduled Import has been updated!', 'the-events-calendar' );
tribe_notice( 'tribe-aggregator-schedule-edit-complete', $html, 'type=success' );
return $result;
}