assets()->registerStyles(); return array_keys( $styles ); } /** * load dependent scripts * * @return array */ public function get_script_depends() { $scripts = \Depicter::front()->assets()->registerScripts(); return array_keys( $scripts ); } public function getSlidersList() { $list = [ 0 => __( 'Select Slider', 'depicter' ) ]; $documents = \Depicter::documentRepository()->getList(); foreach( $documents as $document ) { $list[ $document['id'] ] = "[#{$document['id']}]: " . $document['name']; } return $list; } /** * Register 'Slider' widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { /*-----------------------------------------------------------------------------------*/ /* slider_section /*-----------------------------------------------------------------------------------*/ $this->start_controls_section( 'slider_section', array( 'label' => __('Slider', 'depicter' ), ) ); $this->add_control( 'slider_id', [ 'label' => __('Select a Depicter slider','depicter' ), 'type' => Controls_Manager::SELECT, 'label_block' => 'true', 'options' => $this->getSlidersList(), 'default' => 0 ] ); $documents = \Depicter::documentRepository()->getList(); foreach( $documents as $key => $document ) { $args = [ 'isNotPublished' => \Depicter::documentRepository()->isNotPublished( $document['id'], [ 'status' => 'publish' ] ), 'documentStatus' => $document['status'] ]; $markup = \Depicter::view('admin/notices/builders-draft-notice')->with('view_args', $args)->toString(); $this->add_control( 'slider_control_buttons_' . $key, [ 'type' => Controls_Manager::RAW_HTML, 'raw' => $markup, 'condition' => [ 'slider_id' => $document['id'] ] ] ); } $this->end_controls_section(); } /** * Render image box widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); if ( $settings['slider_id'] ) { echo \Depicter::front()->render()->document( $settings['slider_id'] ); } } }