Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* BEGIN METABOXES */
- $meta_boxes[] = array(
- 'id' => 'service_questions',
- 'title' => 'Default service content',
- 'pages' => array( 'service_page' ),
- 'visible' => array(
- 'when' => array(
- array( 'prefix_template_select', '=', 'default_v2' ),
- ),
- 'relation' => 'or'
- ),
- 'fields' => array(
- array(
- 'type' => 'heading',
- 'name' => 'Who is this service for?',
- ),
- array(
- 'id' => 'service_who',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'type' => 'heading',
- 'name' => 'What are the requirements for this service?',
- ),
- array(
- 'id' => 'service_requirements',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'name' => 'Add prerequisite approvals?',
- 'id' => 'service_accordion_select',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No',
- 'columns' => '6'
- ),
- array(
- 'id' => 'accordion_row',
- 'type' => 'group',
- 'visible' => array(
- 'when' => array(
- array('service_accordion_select', '=', true),
- ),
- ),
- 'fields' => array(
- array(
- 'name' => ('Prerequisite row title'),
- 'id' => 'accordion_row_title',
- 'type' => 'text',
- 'required' => true,
- 'class' => 'percent-100'
- ),
- array(
- 'id' => 'accordion_group',
- 'type' => 'group',
- 'clone' => true,
- 'sort_clone' => true,
- 'add_button' => '+ Add accordion',
- 'fields' => array(
- My_Prefix_Standard_Metaboxes::prefix_metabox_double_wysiwyg($section_name = 'Accordion title', $wysiwyg_desc = 'Accordion content', $columns = 12, $clone = true),
- )
- )
- ),
- ),
- array(
- 'type' => 'heading',
- 'name' => 'Where is this located and when is it availble?',
- ),
- array(
- 'id' => 'service_where_when',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'name' => 'Include contact information?',
- 'id' => 'service_where_when_address_select',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No'
- ),
- array(
- 'id' => 'service_where_when_std_address',
- 'type' => 'group',
- 'hidden' => array('service_where_when_address_select', false),
- 'fields' => array(
- My_Prefix_Standard_Metaboxes::prefix_metabox_v2_address_fields(),
- array(
- 'id' => 'prefix_connect_general',
- 'type' => 'group',
- // List of sub-fields
- 'fields' => array(
- array(
- 'type' => 'heading',
- 'name' => 'Email, fax, etc.',
- ),
- array(
- 'name' => 'Email',
- 'id' => 'prefix_connect_email',
- 'type' => 'email',
- 'desc' => 'example@phila.gov',
- ),
- array(
- 'name' => 'Explanation text for email',
- 'id' => 'prefix_connect_email_exp',
- 'type' => 'text',
- 'desc' => 'Ex. For press inquiries contact:',
- ),
- array(
- 'name' => 'Fax',
- 'id' => 'prefix_connect_fax',
- 'type' => 'phone',
- 'desc' => '(###)-###-####',
- ),
- array(
- 'id' => 'prefix_connect_social',
- 'type' => 'group',
- 'fields' => array(
- array(
- 'type' => 'heading',
- 'name' => 'Social',
- ),
- array(
- 'name' => 'Facebook URL',
- 'id' => 'prefix_connect_social_facebook',
- 'type' => 'url',
- 'desc' => 'Example: https://www.facebook.com/',
- ),
- array(
- 'name' => 'Twitter URL',
- 'id' => 'prefix_connect_social_twitter',
- 'type' => 'url',
- 'desc' => 'Example: https://twitter.com/PhiladelphiaGov'
- ),
- array(
- 'name' => 'Instagram URL',
- 'id' => 'prefix_connect_social_instagram',
- 'type' => 'url',
- 'desc' => 'Example: https://www.instagram.com/'
- ),
- array(
- 'name' => 'YouTube URL',
- 'id' => 'prefix_connect_social_youtube',
- 'type' => 'url',
- 'desc' => 'Example: https://www.youtube.com/user/'
- ),
- array(
- 'name' => 'Flickr URL',
- 'id' => 'prefix_connect_social_flickr',
- 'type' => 'url',
- 'desc' => 'Example: https://www.flickr.com/photos/'
- ),
- ),
- )
- )
- )
- ),
- ),
- array(
- 'type' => 'heading',
- 'name' => 'Are there any costs associated with this service?',
- ),
- array(
- 'name' => 'Add cost callout?',
- 'id' => 'service_cost_callout_select',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No'
- ),
- array(
- 'id' => 'service_cost_callout',
- 'type' => 'group',
- 'visible' => array('service_cost_callout_select', true),
- 'fields' => array(
- array(
- 'id' => 'cost_callout',
- 'type' => 'group',
- 'clone' => true,
- 'max_clone' => 3,
- 'fields' => array(
- array(
- 'type' => 'text',
- 'id' => 'heading',
- 'name' => 'Cost type',
- 'desc' => 'E.g. License cost'
- ),
- array(
- 'type' => 'number',
- 'id' => 'amount',
- 'name' => 'Cost amount, in dollars',
- 'desc' => 'E.g. 20.00'
- ),
- array(
- 'id' => 'description',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- )
- )
- )
- ),
- array(
- 'id' => 'service_cost',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- //Name/id doesn't match because reqirements we not defined before this made it to production
- 'name' => 'Add modal information?',
- 'id' => 'service_payment_info_select',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No'
- ),
- array(
- 'visible' => array('service_payment_info_select', true),
- 'id' => 'service_modal_info_link_text',
- 'name' => 'Clickable link text',
- 'type' => 'text',
- ),
- array(
- 'visible' => array('service_payment_info_select', true),
- 'id' => 'service_payment_info',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'type' => 'heading',
- 'name' => 'How can someone get this service?',
- ),
- array(
- 'id' => 'service_how',
- 'type' => 'wysiwyg',
- 'name' => 'Use this section for introduction content. Not required.',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'name' => 'Add single stepped content?',
- 'id' => 'service_how_stepped_select',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No',
- 'columns' => '6'
- ),
- array(
- 'name' => 'Add mutiple stepped content groups?',
- 'id' => 'service_how_stepped_select_multi',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No',
- 'columns' => '6'
- ),
- array(
- 'id' => 'service_how_stepped_content',
- 'type' => 'group',
- 'visible' => array('service_how_stepped_select', true),
- 'fields' => array(
- array(
- 'id' => 'service_how_stepped_content_intro',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- My_Prefix_Standard_Metaboxes::prefix_metabox_v2_ordered_content(),
- )
- ),
- array(
- 'id' => 'service_how_stepped_content_multi',
- 'type' => 'group',
- 'clone' => true,
- 'add_button' => '+ Add a step group',
- 'visible' => array('service_how_stepped_select_multi', true),
- 'fields' => array(
- array(
- 'id' => 'service_how_stepped_content_intro',
- 'type' => 'text',
- 'name' => 'Step group heading',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- My_Prefix_Standard_Metaboxes::prefix_metabox_v2_ordered_content(),
- )
- ),
- array(
- 'id' => 'service_how_ending_content',
- 'type' => 'wysiwyg',
- 'visible' => array(
- 'when' => array(
- array('service_how_stepped_select', true ),
- array('service_how_stepped_select_multi', true),
- ),
- 'relation' => 'or'
- ),
- 'name' => 'Display more content after all steps.',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- array(
- 'type' => 'heading',
- 'name' => 'Are there renewal requirements for this service?',
- ),
- array(
- 'id' => 'service_renewal_requirements',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- ),
- )
- );
- /* END METABOXES */
- /*NEEDED CLASSES */
- /* Registers discrete, reusable metaboxes */
- if ( class_exists('My_Prefix_Standard_Metaboxes' ) ){
- $prefix_standard_metaboxes_load = new My_Prefix_Standard_Metaboxes();
- }
- class My_Prefix_Standard_Metaboxes {
- public static function prefix_wysiwyg_options_basic( $editor_height = 200 ){
- return array(
- 'media_buttons' => false,
- 'teeny' => true,
- 'dfw' => false,
- 'tinymce' => prefix_setup_tiny_mce_basic(
- array(
- 'format_select' => false
- )
- ),
- 'editor_height' => $editor_height,
- );
- }
- public static function prefix_wysiwyg_options_basic_heading(){
- return array(
- 'media_buttons' => false,
- 'teeny' => true,
- 'dfw' => false,
- 'tinymce' => prefix_setup_tiny_mce_basic(
- array(
- 'format_select' => true,
- 'heading_level' => 'h3'
- )
- ),
- 'editor_height' => 200,
- );
- }
- public static function prefix_metabox_v2_ordered_content(){
- //Purpose: To display content in a stepped order on the front-end
- return array(
- 'id' => 'prefix_ordered_content',
- 'type' => 'group',
- 'clone' => true,
- 'sort_clone' => true,
- 'add_button' => '+ Add a step',
- 'fields' => array(
- array(
- //TODO: determine way to display step numbers in admin
- 'placeholder' => 'Step Heading',
- 'id' => 'prefix_step_wysiwyg_heading',
- 'type' => 'text',
- 'class' => 'percent-95'
- ),
- array(
- 'id' => 'prefix_step_wysiwyg_content',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic()
- ),
- array(
- 'name' => 'Does this step contain an address?',
- 'id' => 'prefix_address_step',
- 'type' => 'switch',
- 'on_label' => 'Yes',
- 'off_label' => 'No'
- ),
- array(
- 'id' => 'prefix_std_address',
- 'type' => 'group',
- 'visible' => array('prefix_address_step', true),
- 'fields' => array(
- My_Prefix_Standard_Metaboxes::prefix_metabox_v2_address_fields(),
- ),
- ),
- )
- );
- }
- public static function prefix_metabox_v2_address_fields($id = 'address_group'){
- //Default address fields
- return array(
- 'id' => $id,
- 'type' => 'group',
- 'fields' => array(
- array(
- 'type' => 'heading',
- 'name' => 'Address',
- ),
- array(
- 'name' => 'Street Address 1',
- 'id' => 'prefix_std_address_st_1',
- 'type' => 'text',
- ),
- array(
- 'name' => 'Street Address 2',
- 'id' => 'prefix_std_address_st_2',
- 'type' => 'text',
- ),
- array(
- 'name' => 'City',
- 'id' => 'prefix_std_address_city',
- 'type' => 'text',
- ),
- array(
- 'name' => 'State',
- 'id' => 'prefix_std_address_state',
- 'type' => 'text',
- ),
- array(
- 'name' => 'Zip',
- 'id' => 'prefix_std_address_zip',
- 'type' => 'text',
- ),
- array(
- 'name' => 'Phone number',
- 'id' => 'prefix_std_address_phone',
- 'type' => 'phone',
- ),
- ),
- );
- }
- public static function prefix_metabox_double_wysiwyg($section_name = 'Section title', $wysiwyg_desc = '', $columns = 12){
- //WYSIWYG with Title
- return array(
- 'id' => 'prefix_custom_wysiwyg',
- 'type' => 'group',
- 'clone' => false,
- 'columns'=> $columns,
- 'fields' => array(
- array(
- 'type' => 'heading',
- 'name' => $section_name,
- ),
- array(
- 'id' => 'prefix_wysiwyg_title',
- 'type' => 'wysiwyg',
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic($editor_height = 100)
- ),
- array(
- 'id' => 'prefix_wysiwyg_content',
- 'type' => 'wysiwyg',
- 'desc' => $wysiwyg_desc,
- 'options' => My_Prefix_Standard_Metaboxes::prefix_wysiwyg_options_basic_heading()
- )
- )
- );
- }
- }/*END CLASS*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement