Merge branch 'feature-event-specs'

This commit is contained in:
Brian Miyaji
2018-04-29 09:51:13 +10:00
10 changed files with 526 additions and 4 deletions

View File

@@ -707,4 +707,24 @@ class SP_Event extends SP_Custom_Post{
public function sort_timeline( $a, $b ) {
return $a['time'] - $b['time'];
}
/**
* Returns formatted event specs
*
* @access public
* @return array
*/
public function specs( $neg = null ) {
$specs = (array)get_post_meta( $this->ID, 'sp_specs', true );
$spec_labels = (array)sp_get_var_labels( 'sp_spec', $neg, false );
$data = array();
foreach ( $spec_labels as $key => $value ):
$spec = sp_array_value( $specs, $key, null );
if ( $spec == null )
continue;
$data[ $value ] = sp_array_value( $specs, $key, ' ' );
endforeach;
return $data;
}
}