max-kk
4/14/2019 - 1:59 PM

Register custom settings for contest in the Addons section

Register custom settings for contest in the Addons section

<?php
// Copy after

add_action('plugins_loaded', 'FvAddonSettingsRun', 11);

function FvAddonSettingsRun() {
    if (!class_exists('FvAddonBase')) {
        return;
    }
  
        ## ============ MAP :: START ============
        FV_Admin_Contest_Meta_Helper::register_section('address', 'Shooting address');

        FV_Admin_Contest_Meta_Helper::register_field('map_address', array(
            'label'     => 'Address',
            'label_class' => 'col-sm-6 control-label',

            'wrap_input'    => 'div',
            'wrap_input_class' => 'col-sm-18',

            'container' => 'clearfix',
            'type'      => 'text',
        ), 'address');

        FV_Admin_Contest_Meta_Helper::register_field('marker_radius', array(
            'label' => 'Radius:',
            'label_class' => 'col-sm-6 control-label',

            'wrap_input'    => 'div',
            'wrap_input_class' => 'col-sm-18',

            'container' => 'clearfix',
            'type'      => 'select',
            'options'   => array(
                '100'  => '100 m',
                '200'  => '200 m',
                '300'  => '300 m',
                '500'  => '500 m',
                '1000'  => '1000 m',
            ),
            'default'   => '500',
            'desc'      => '',

            'sanitize'  => 'number',
        ), 'address');
  

    // To get the meta:
  
        if ( $contest->meta()->get_value('marker_radius') ) {
            $marker_radius = $contest->meta()->get_value('marker_radius');                
        }

}