AbstractDivi.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | namespace RT\ThePostGrid\Abstracts; |
| 4 | |
| 5 | use \ET_Builder_Module; |
| 6 | |
| 7 | abstract class AbstractDivi extends ET_Builder_Module { |
| 8 | |
| 9 | public $vb_support = 'on'; |
| 10 | protected $video_id = 'PLeKWXbEok0'; |
| 11 | public $icon_path; |
| 12 | |
| 13 | public function init() { |
| 14 | $this->name = $this->get_module_name(); |
| 15 | $this->icon_path = $this->get_icon_path(); |
| 16 | $this->folder_name = 'et_pb_the_post_grid_module'; |
| 17 | $this->settings_modal_toggles = $this->get_settings_modal_toggles(); |
| 18 | $this->help_videos = $this->help_videos(); |
| 19 | } |
| 20 | |
| 21 | protected function get_module_name() { |
| 22 | return esc_html__( 'The Post Grid Module Name', 'the-post-grid' ); |
| 23 | } |
| 24 | |
| 25 | protected function get_icon_path() { |
| 26 | return trailingslashit( RT_THE_POST_GRID_PLUGIN_PATH ) . "/assets/images/gutenberg/grid-layout.svg"; |
| 27 | } |
| 28 | |
| 29 | protected function help_videos() { |
| 30 | return [ |
| 31 | [ |
| 32 | 'id' => $this->video_id, |
| 33 | 'name' => $this->name, |
| 34 | ], |
| 35 | ]; |
| 36 | } |
| 37 | |
| 38 | public function get_settings_modal_toggles() { |
| 39 | $general = [ |
| 40 | 'tpg_layout' => esc_html__( 'Layout', 'the-post-grid' ), |
| 41 | 'tpg_query' => esc_html__( 'Query Builder', 'the-post-grid' ), |
| 42 | 'tpg_filter' => esc_html__( 'Filter (Front-end)', 'the-post-grid' ), |
| 43 | 'tpg_pagination' => esc_html__( 'Pagination', 'the-post-grid' ), |
| 44 | 'tpg_links' => esc_html__( 'Post Link', 'the-post-grid' ), |
| 45 | 'tpg_selection' => esc_html__( 'Field Selection', 'the-post-grid' ), |
| 46 | 'tpg_section_title' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 47 | 'tpg_post_title' => esc_html__( 'Post title', 'the-post-grid' ), |
| 48 | 'tpg_thumbnail' => esc_html__( 'Thumbnail', 'the-post-grid' ), |
| 49 | 'tpg_excerpt' => esc_html__( 'Excerpt / Content', 'the-post-grid' ), |
| 50 | 'tpg_meta_data' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 51 | 'tpg_acf' => esc_html__( 'ACF Settings', 'the-post-grid' ), |
| 52 | 'tpg_read_more' => esc_html__( 'Read More', 'the-post-grid' ), |
| 53 | ]; |
| 54 | |
| 55 | $advanced = [ |
| 56 | 'tpg_section_title_style' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 57 | 'tpg_post_title_style' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 58 | 'tpg_thumbnail_style' => esc_html__( 'Thumbnail', 'the-post-grid' ), |
| 59 | 'tpg_excerpt_style' => esc_html__( 'Excerpt / Content', 'the-post-grid' ), |
| 60 | 'tpg_meta_data_style' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 61 | 'tpg_social_share_style' => esc_html__( 'Social Share', 'the-post-grid' ), |
| 62 | 'tpg_read_more_style' => esc_html__( 'Read More', 'the-post-grid' ), |
| 63 | 'tpg_filter_style' => esc_html__( 'Front-End Filter', 'the-post-grid' ), |
| 64 | 'tpg_pagination_style' => esc_html__( 'Pagination / Load More', 'the-post-grid' ), |
| 65 | 'tpg_acf_style' => esc_html__( 'Advanced Custom Field (ACF)', 'the-post-grid' ), |
| 66 | 'tpg_card_style' => esc_html__( 'Card (Post Item)', 'the-post-grid' ), |
| 67 | ]; |
| 68 | |
| 69 | // Let child filter the array if needed |
| 70 | $general = $this->filter_general_toggles( $general ); |
| 71 | $advanced = $this->filter_advanced_toggles( $advanced ); |
| 72 | |
| 73 | return [ |
| 74 | 'general' => [ 'toggles' => $general ], |
| 75 | 'advanced' => [ 'toggles' => $advanced ], |
| 76 | ]; |
| 77 | } |
| 78 | |
| 79 | protected function filter_general_toggles( $toggles ) { |
| 80 | return $toggles; |
| 81 | } |
| 82 | |
| 83 | protected function filter_advanced_toggles( $toggles ) { |
| 84 | return $toggles; |
| 85 | } |
| 86 | |
| 87 | } |