-
-
Save mgratch/6044e6178827f93f6943adf693c78305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rwmb_meta_boxes', 'sf_select_modules_meta_boxes' ); | |
function sf_select_modules_meta_boxes( $meta_boxes ) { | |
$prefix = 'sf_sign_'; | |
$meta_boxes[] = array( | |
'title' => 'Add A Module', | |
'id' => 'add-module', | |
'post_types' => array( | |
'sign', | |
), | |
'context' => 'normal', | |
'priority' => 'high', | |
'status' => 'publish', | |
'autosave' => true, | |
'fields' => array( | |
array( | |
'id' => $prefix . 'modules', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'module_type', | |
'name' => 'Select the type of module to add', | |
'type' => 'select', | |
'options' => array( | |
'empty-module' => 'None', | |
'image-module' => 'Image', | |
'video-module' => 'Video', | |
'text-module' => 'Text', | |
'time-greeting-module' => 'Time/Greeting', | |
'wayfinder-module' => 'Wayfinder', | |
'room-number-module' => 'Room Name/Number', | |
'room-availability-module' => 'Room Availability', | |
'room-current-activity-module' => 'Current Room Activity', | |
'room-upcoming-activity-module' => 'Upcoming Room Activity', | |
), | |
'required' => 1, | |
), | |
// image module | |
array( | |
'id' => $prefix . 'image_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'image_module_image', | |
'type' => 'single_image', | |
'name' => 'Add Image', | |
), | |
array( | |
'id' => $prefix . 'image_module_image_width', | |
'type' => 'number', | |
'name' => 'Image Width', | |
'desc' => 'Percentage', | |
'std' => '100', | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'image-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// video module | |
array( | |
'id' => $prefix . 'video_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'video_module_video_source', | |
'name' => 'Select your video source', | |
'type' => 'select', | |
'placeholder' => 'Select a Video Source', | |
'options' => array( | |
'embedded-video' => 'Embedded', | |
'local-video' => 'Local', | |
), | |
), | |
array( | |
'id' => $prefix . 'video_module_video_oembed', | |
'type' => 'oembed', | |
'name' => 'Add Video URL', | |
'desc' => 'copy and paste the shareable url from your favorite video sources.', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'video_module_video_source', | |
'=', | |
'embedded-video', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
array( | |
'id' => $prefix . 'video_module_video', | |
'type' => 'video', | |
'name' => 'Add video', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'video_module_video_source', | |
'=', | |
'local-video', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
array( | |
'id' => $prefix . 'video_module_video_width', | |
'type' => 'number', | |
'name' => 'Video Width', | |
'desc' => 'Percentage', | |
'std' => '100', | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'video-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// text module | |
array( | |
'id' => $prefix . 'text_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'text_module_text', | |
'name' => 'Create your own content', | |
'type' => 'wysiwyg', | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'text-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Time Greeting Module | |
array( | |
'id' => $prefix . 'time_greeting_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'time_greeting_module_time_greetings', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'time_greeting_module_start_time', | |
'name' => 'Start Time', | |
'type' => 'time', | |
'columns' => 3, | |
), | |
array( | |
'id' => $prefix . 'time_greeting_module_end_time', | |
'name' => 'End Time', | |
'type' => 'time', | |
'columns' => 3, | |
), | |
array( | |
'id' => $prefix . 'time_greeting_module_greeting', | |
'type' => 'text', | |
'name' => 'Greeting', | |
'datalist' => array( | |
'id' => 'date_time_greetings', | |
'options' => array( | |
'Good Morning', | |
'Good Afternoon', | |
'Good Evening', | |
'Good Night', | |
), | |
), | |
'columns' => 6, | |
), | |
), | |
'clone' => 1, | |
'sort_clone' => 1, | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'time-greeting-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// WayFinder Module | |
array( | |
'id' => $prefix . 'wayfinder_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'wayfinder_module_font_color', | |
'name' => 'Font Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'wayfinder-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Room Number Module | |
array( | |
'id' => $prefix . 'room_number_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'room_number_module_font_color', | |
'name' => 'Font Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'room-number-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Room availability Module | |
array( | |
'id' => $prefix . 'room_availability_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'room_avaliablity_module_available_color', | |
'name' => 'Available Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
'std' => '#336666', | |
), | |
array( | |
'id' => $prefix . 'room_avaliablity_module_unavailable_color', | |
'name' => 'Unavailable Color', | |
'type' => 'color', | |
'size' => 7, | |
'std' => '#ff0000', | |
), | |
array( | |
'id' => $prefix . 'room_availability_module_font_color', | |
'name' => 'Font Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'room-availability-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Current Room Activity Module | |
array( | |
'id' => $prefix . 'room_current_activity_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'room_current_activity_module_font_color', | |
'name' => 'Font Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'room-current-activity-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Upcoming Room Activity Module | |
array( | |
'id' => $prefix . 'room_upcoming_activity_module_opts', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => $prefix . 'room_upcoming_activity_module_font_color', | |
'name' => 'Font Color', | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => 1, | |
), | |
), | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_type', | |
'=', | |
'room-upcoming-activity-module', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
/* Start Background Settings */ | |
// Select Background Type | |
array( | |
'id' => $prefix . 'module_background', | |
'name' => 'Background Options', | |
'type' => 'select', | |
'placeholder' => 'Select an Item', | |
'options' => array( | |
'background-none' => 'None', | |
'background-image-color' => 'Image/Color', | |
'background-video' => 'Video', | |
), | |
'std' => array( | |
'background-none', | |
), | |
'' => '', | |
), | |
// Select Image/Color | |
array( | |
'id' => $prefix . 'module_background_image_color', | |
'name' => 'Background', | |
'type' => 'background', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_background', | |
'=', | |
'background-image-color', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Select Video Source | |
array( | |
'id' => $prefix . 'module_background_video_source', | |
'name' => 'Select your video source', | |
'type' => 'select', | |
'placeholder' => 'Select a Video Source', | |
'options' => array( | |
'embedded-video' => 'Embedded', | |
'local-video' => 'Local', | |
), | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_background', | |
'=', | |
'background-video', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Oembed Video Source | |
array( | |
'id' => $prefix . 'module_background_video_oembed', | |
'type' => 'oembed', | |
'name' => 'Add Video URL', | |
'desc' => 'copy and paste the shareable url from your favorite video sources.', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_background_video_source', | |
'=', | |
'embedded-video', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
// Local Video Source | |
array( | |
'id' => $prefix . 'module_background_video', | |
'type' => 'video', | |
'name' => 'Add video', | |
'visible' => array( | |
'when' => array( | |
array( | |
$prefix . 'module_background_video_source', | |
'=', | |
'local-video', | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
/* End Background Settings */ | |
), | |
'clone' => 1, | |
'sort_clone' => 1, | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
), | |
), | |
); | |
return $meta_boxes; | |
} | |
add_filter( 'rwmb_meta_boxes', 'sf_room_availability_meta_boxes' ); | |
function sf_room_availability_meta_boxes( $meta_boxes ) { | |
$meta_boxes[] = array( | |
'title' => 'Room Availability', | |
'id' => 'room-availability', | |
'post_types' => array( | |
'sign', | |
), | |
'context' => 'normal', | |
'priority' => 'high', | |
'status' => 'publish', | |
'autosave' => true, | |
'fields' => array( | |
array( | |
'id' => 'sf_room_avaliablity', | |
'type' => 'group', | |
'fields' => array( | |
array( | |
'id' => 'sf_room_avaliablity_module_start_time', | |
'name' => 'Start Time', | |
'type' => 'time', | |
'js_options' => array( | |
'stepMinute' => '30', | |
), | |
'columns' => 3, | |
), | |
array( | |
'id' => 'sf_room_avaliablity_module_end_time', | |
'name' => 'End Time', | |
'type' => 'time', | |
'js_options' => array( | |
'stepMinute' => '30', | |
), | |
'columns' => 3, | |
), | |
array( | |
'id' => 'sf_room_avaliablity_module_event_name', | |
'type' => 'text', | |
'name' => 'Event Name', | |
'datalist' => array( | |
'id' => 'date_time_greetings', | |
'options' => array( | |
'Good Morning', | |
'Good Afternoon', | |
'Good Evening', | |
'Good Night', | |
), | |
), | |
'columns' => 6, | |
), | |
array( | |
'id' => 'sf_room_avaliablity_module_event_subheading', | |
'type' => 'text', | |
'name' => 'Subheading', | |
'placeholder' => 'Host: John Doe', | |
), | |
), | |
'clone' => 1, | |
'sort_clone' => 1, | |
'default_state' => 'expanded', | |
'groupfield' => 'text', | |
), | |
), | |
'visible' => array( | |
'when' => array( | |
array( | |
'sf_sign_module_type', | |
'=', | |
'room-availability-module', | |
), | |
array( | |
'sf_sign_module_type', | |
'=', | |
'room-current-activity-module', | |
), | |
array( | |
'sf_sign_module_type', | |
'=', | |
'room-upcoming-activity-module', | |
), | |
), | |
'relation' => 'or', | |
), | |
); | |
return $meta_boxes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment