PluginProbe
Flex Posts – Responsive Posts Block / trunk
Flex Posts – Responsive Posts Block vtrunk
2.1.0 trunk 1.12.0 2.0.0
flex-posts / includes / class-flex-posts-list.php

class-flex-posts-list.php in Flex Posts – Responsive Posts Block trunk, at includes/class-flex-posts-list.php

64 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Flex Posts List Widget
4 *
5 * @package Flex Posts
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Flex Posts List widget class
14 */
15 class Flex_Posts_List extends Flex_Posts_Widget {
16
17 /**
18 * Set base ID, name & options
19 */
20 public function __construct() {
21 parent::__construct(
22 'flex-posts-list',
23 esc_html__( 'Flex Posts', 'flex-posts' ),
24 array(
25 'description' => esc_html__( 'Displays posts list.', 'flex-posts' ),
26 )
27 );
28
29 $this->enqueue();
30 }
31
32 /**
33 * Get form fields
34 */
35 public function get_fields() {
36 /**
37 * Filter: flex_posts_list_fields
38 *
39 * Filter the form fields definition for the list widget. Callback
40 * receives the default parent fields and should return an array of
41 * field definitions.
42 *
43 * @param array $fields Default fields from parent::get_fields().
44 * @return array Modified fields.
45 *
46 * Example:
47 * add_filter( 'flex_posts_list_fields', function( $fields ) {
48 * $fields['custom'] = array( 'type' => 'text', 'label' => 'Custom' );
49 * return $fields;
50 * } );
51 */
52 return apply_filters( 'flex_posts_list_fields', parent::get_fields() );
53 }
54
55 /**
56 * Front-end display of widget.
57 *
58 * @param array $instance Saved values from database.
59 */
60 public function front( $instance ) {
61 flex_posts_display( $instance );
62 }
63 }
64