name = 'scplaylist'; $this->label = __("Playlists (SoundCloud)",'acf-scp'); $this->category = 'content'; $this->defaults = array( 'button_label' => __('Browse Playlist!','acf-scp'), 'return_format' => 'array', ); // do not delete! parent::__construct(); } /* * render_field() * */ function render_field( $field ) { // strip out empty values in the array $field = array_filter( $field ); $defaults = array( 'name' => '', 'value' => array(), ); $field = wp_parse_args( $field, $defaults ); extract( $field ); $input_values = scp_extract_values( $value ); $check_value = array_shift($value); $label = ( !empty($check_value) ) ? scp_get_playlist_label( $input_values ) : $button_label; if( is_scp_ready() ) : ?>
here', scp_settings_url( array() )),'acf-scp' ) ; endif; } /* * render_field_settings() * */ function render_field_settings( $field ) { // Placeholder acf_render_field_setting( $field, array( 'label' => __('Button Label','acf-scp'), 'instructions' => __(''), 'type' => 'text', 'name' => 'button_label', )); // Output format acf_render_field_setting( $field, array( 'label' => __('Return Value','acf-scp'), 'instructions' => __('Specify the returned value format on template','acf-scp'), 'type' => 'radio', 'name' => 'return_format', 'layout' => 'horizontal', 'choices' => array( 'array' => __("Playlist Array",'acf-scp'), 'list' => __("List of Tracks",'acf-scp') ) )); } /* * input_admin_enqueue_scripts() * */ function input_admin_enqueue_scripts() { $dir = plugin_dir_url( __FILE__ ); wp_enqueue_script('thickbox'); wp_register_script( 'scp-selectize-plug-js', "{$dir}assets/js/selectize.js", array('jquery'), '0.12.0' , false); wp_enqueue_script('scp-selectize-plug-js'); wp_register_script( 'scp-scsdk-js', "//connect.soundcloud.com/sdk.js", array('jquery') ); wp_enqueue_script('scp-scsdk-js'); wp_register_script( 'scp-js', "{$dir}assets/js/acf_scp.js", array('jquery','scp-scsdk-js'), SCP_VERSION , false); wp_enqueue_script('scp-js'); wp_enqueue_style('thickbox'); wp_register_style( 'scp-selectize-plug-style', "{$dir}assets/css/selectize.css" ); wp_enqueue_style('scp-selectize-plug-style'); wp_register_style( 'scp-style', "{$dir}assets/css/acf_scp.css", array(), SCP_VERSION , false ); wp_enqueue_style('scp-style'); } /* * input_admin_head() * */ function input_admin_head() { // add class .scp-active to body add_filter( 'admin_body_class', array( $this, 'update_body_class' ) ); } /* * input_admin_footer() * */ function input_admin_footer() { $dir = plugin_dir_url( __FILE__ ); $options = scp_get_app(); $acf_scp = array( 'fieldType' => $this->name, 'client_app_key' => $options['clientkey'], 'html_callback' => $dir . 'inc/callback.html', ); // render browse playlist in the footer for global modal view $this->render_scp_browse(); ?>