ContentTabController.php
8 months ago
SectionTitleSettingsStyle.php
8 months ago
SettingsTabController.php
8 months ago
StyleTabController.php
8 months ago
TimelineContentTabController.php
8 months ago
TimelineContentTabController.php
445 lines
| 1 | <?php |
| 2 | |
| 3 | namespace RT\ThePostGrid\Controllers\Blocks\BlockController; |
| 4 | |
| 5 | use RT\ThePostGrid\Helpers\Fns; |
| 6 | |
| 7 | //phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 8 | |
| 9 | /** |
| 10 | * Class TimelineContentTabController |
| 11 | */ |
| 12 | class TimelineContentTabController { |
| 13 | /** |
| 14 | * @param $attribute_args |
| 15 | * |
| 16 | * @return mixed|void |
| 17 | */ |
| 18 | public static function get_controller( $attribute_args ) { |
| 19 | $prefix = $attribute_args['prefix']; |
| 20 | $default_layout = $attribute_args['default_layout']; |
| 21 | |
| 22 | $content_attribute = [ |
| 23 | 'uniqueId' => [ |
| 24 | 'type' => 'string', |
| 25 | 'default' => '', |
| 26 | ], |
| 27 | |
| 28 | 'preview' => [ |
| 29 | 'type' => 'boolean', |
| 30 | 'default' => false, |
| 31 | ], |
| 32 | |
| 33 | 'prefix' => [ |
| 34 | 'type' => 'string', |
| 35 | 'default' => $prefix, |
| 36 | ], |
| 37 | |
| 38 | 'offset_img_position' => [ |
| 39 | 'type' => 'string', |
| 40 | 'default' => 'offset-image-left', |
| 41 | ], |
| 42 | |
| 43 | 'is_builder' => [ |
| 44 | 'type' => 'string', |
| 45 | 'default' => '', |
| 46 | ], |
| 47 | |
| 48 | // Layouts. |
| 49 | |
| 50 | 'query_change' => [ |
| 51 | 'type' => 'boolean', |
| 52 | 'default' => false, |
| 53 | ], |
| 54 | |
| 55 | $prefix . '_layout' => [ |
| 56 | 'type' => 'string', |
| 57 | 'default' => $default_layout, |
| 58 | ], |
| 59 | |
| 60 | 'middle_border' => [ |
| 61 | 'type' => 'string', |
| 62 | 'default' => 'no', |
| 63 | ], |
| 64 | |
| 65 | 'grid_column' => [ |
| 66 | 'type' => 'object', |
| 67 | 'default' => (object) [ |
| 68 | 'lg' => '', |
| 69 | 'md' => '', |
| 70 | 'sm' => '', |
| 71 | ], |
| 72 | ], |
| 73 | |
| 74 | 'grid_layout_style' => [ |
| 75 | 'type' => 'string', |
| 76 | 'default' => 'tpg-even', |
| 77 | ], |
| 78 | |
| 79 | 'list_layout_alignment' => [ |
| 80 | 'type' => 'string', |
| 81 | 'default' => '', |
| 82 | 'style' => [ |
| 83 | (object) [ |
| 84 | 'selector' => '{{RTTPG}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper {align-items: {{list_layout_alignment}}; }', |
| 85 | ], |
| 86 | ], |
| 87 | ], |
| 88 | |
| 89 | 'list_flex_direction' => [ |
| 90 | 'type' => 'string', |
| 91 | 'default' => '', |
| 92 | 'style' => [ |
| 93 | (object) [ |
| 94 | 'selector' => '{{RTTPG}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper {flex-direction: {{list_flex_direction}}; }', |
| 95 | ], |
| 96 | ], |
| 97 | ], |
| 98 | |
| 99 | 'main_wrapper_hover_tab' => [ |
| 100 | 'type' => 'string', |
| 101 | 'default' => 'normal', |
| 102 | ], |
| 103 | |
| 104 | 'grid_offset_col_width' => [ |
| 105 | 'type' => 'string', |
| 106 | 'default' => '', |
| 107 | ], |
| 108 | |
| 109 | 'full_wrapper_align' => [ |
| 110 | 'type' => 'object', |
| 111 | 'default' => [], |
| 112 | 'style' => [ |
| 113 | (object) [ |
| 114 | 'selector' => '{{RTTPG}} .tpg-post-holder div {text-align: {{full_wrapper_align}}; } |
| 115 | {{RTTPG}} .rt-tpg-container .rt-el-post-meta {justify-content: {{full_wrapper_align}}; }', |
| 116 | ], |
| 117 | ], |
| 118 | ], |
| 119 | |
| 120 | // Query Build. |
| 121 | |
| 122 | 'show_title' => [ |
| 123 | 'type' => 'string', |
| 124 | 'default' => '', |
| 125 | ], |
| 126 | |
| 127 | 'multiple_post_type' => [ |
| 128 | 'type' => 'string', |
| 129 | 'default' => '', |
| 130 | ], |
| 131 | |
| 132 | 'post_type' => [ |
| 133 | 'type' => 'string', |
| 134 | 'default' => 'post', |
| 135 | ], |
| 136 | |
| 137 | 'post_types' => [ |
| 138 | 'type' => 'array', |
| 139 | 'default' => [], |
| 140 | ], |
| 141 | |
| 142 | 'post_id' => [ |
| 143 | 'type' => 'string', |
| 144 | 'default' => '', |
| 145 | ], |
| 146 | |
| 147 | 'exclude' => [ |
| 148 | 'type' => 'string', |
| 149 | 'default' => '', |
| 150 | ], |
| 151 | |
| 152 | 'post_limit' => [ |
| 153 | 'type' => 'string', |
| 154 | 'default' => '', |
| 155 | ], |
| 156 | |
| 157 | 'offset' => [ |
| 158 | 'type' => 'string', |
| 159 | 'default' => '', |
| 160 | ], |
| 161 | |
| 162 | 'instant_query' => [ |
| 163 | 'type' => 'string', |
| 164 | 'default' => '', |
| 165 | ], |
| 166 | |
| 167 | // Query Advance Filter give below. |
| 168 | |
| 169 | 'taxonomy_lists' => [ |
| 170 | 'type' => 'object', |
| 171 | 'default' => [], |
| 172 | ], |
| 173 | |
| 174 | 'author' => [ |
| 175 | 'type' => 'string', |
| 176 | 'default' => '', |
| 177 | ], |
| 178 | |
| 179 | 'post_keyword' => [ |
| 180 | 'type' => 'string', |
| 181 | 'default' => '', |
| 182 | ], |
| 183 | |
| 184 | 'relation' => [ |
| 185 | 'type' => 'string', |
| 186 | 'default' => 'OR', |
| 187 | ], |
| 188 | |
| 189 | 'start_date' => [ |
| 190 | 'type' => 'string', |
| 191 | 'default' => '', |
| 192 | ], |
| 193 | 'end_date' => [ |
| 194 | 'type' => 'string', |
| 195 | 'default' => '', |
| 196 | ], |
| 197 | |
| 198 | 'orderby' => [ |
| 199 | 'type' => 'string', |
| 200 | 'default' => 'date', |
| 201 | ], |
| 202 | |
| 203 | 'order' => [ |
| 204 | 'type' => 'string', |
| 205 | 'default' => 'desc', |
| 206 | ], |
| 207 | |
| 208 | 'ignore_sticky_posts' => [ |
| 209 | 'type' => 'string', |
| 210 | 'default' => '', |
| 211 | ], |
| 212 | |
| 213 | 'no_posts_found_text' => [ |
| 214 | 'type' => 'string', |
| 215 | 'default' => 'No posts found.', |
| 216 | ], |
| 217 | |
| 218 | // Front-end Filter Settings. |
| 219 | |
| 220 | 'multiple_taxonomy' => [ |
| 221 | 'type' => 'string', |
| 222 | 'default' => '', |
| 223 | ], |
| 224 | |
| 225 | 'show_taxonomy_filter' => [ |
| 226 | 'type' => 'string', |
| 227 | 'default' => '', |
| 228 | ], |
| 229 | |
| 230 | 'show_author_filter' => [ |
| 231 | 'type' => 'string', |
| 232 | 'default' => '', |
| 233 | ], |
| 234 | |
| 235 | 'show_order_by' => [ |
| 236 | 'type' => 'string', |
| 237 | 'default' => '', |
| 238 | ], |
| 239 | |
| 240 | 'show_sort_order' => [ |
| 241 | 'type' => 'string', |
| 242 | 'default' => '', |
| 243 | ], |
| 244 | |
| 245 | 'show_search' => [ |
| 246 | 'type' => 'string', |
| 247 | 'default' => '', |
| 248 | ], |
| 249 | |
| 250 | 'search_by' => [ |
| 251 | 'type' => 'string', |
| 252 | 'default' => 'all_content', |
| 253 | ], |
| 254 | |
| 255 | 'filter_type' => [ |
| 256 | 'type' => 'string', |
| 257 | 'default' => 'dropdown', |
| 258 | ], |
| 259 | |
| 260 | 'filter_taxonomy' => [ |
| 261 | 'type' => 'string', |
| 262 | 'default' => 'category', |
| 263 | ], |
| 264 | |
| 265 | 'filter_taxonomies' => [ |
| 266 | 'type' => 'array', |
| 267 | 'default' => [], |
| 268 | ], |
| 269 | |
| 270 | 'filter_btn_style' => [ |
| 271 | 'type' => 'string', |
| 272 | 'default' => 'default', |
| 273 | ], |
| 274 | |
| 275 | 'filter_btn_item_per_page' => [ |
| 276 | 'type' => 'string', |
| 277 | 'default' => 'auto', |
| 278 | ], |
| 279 | |
| 280 | 'filter_post_count' => [ |
| 281 | 'type' => 'string', |
| 282 | 'default' => 'no', |
| 283 | ], |
| 284 | |
| 285 | 'tgp_filter_taxonomy_hierarchical' => [ |
| 286 | 'type' => 'string', |
| 287 | 'default' => 'yes', |
| 288 | ], |
| 289 | |
| 290 | 'tpg_hide_all_button' => [ |
| 291 | 'type' => 'string', |
| 292 | 'default' => 'yes', |
| 293 | ], |
| 294 | |
| 295 | 'tax_filter_all_text' => [ |
| 296 | 'type' => 'string', |
| 297 | 'default' => '', |
| 298 | ], |
| 299 | |
| 300 | 'custom_taxonomy_order' => [ |
| 301 | 'type' => 'string', |
| 302 | 'default' => 'yes', |
| 303 | ], |
| 304 | |
| 305 | 'author_filter_all_text' => [ |
| 306 | 'type' => 'string', |
| 307 | 'default' => '', |
| 308 | ], |
| 309 | |
| 310 | // Pagination. |
| 311 | |
| 312 | 'show_pagination' => [ |
| 313 | 'type' => 'string', |
| 314 | 'default' => '', |
| 315 | ], |
| 316 | |
| 317 | 'page' => [ |
| 318 | 'type' => 'number', |
| 319 | 'default' => 1, |
| 320 | ], |
| 321 | |
| 322 | 'display_per_page' => [ |
| 323 | 'type' => 'string', |
| 324 | 'default' => '', |
| 325 | ], |
| 326 | |
| 327 | 'pagination_type' => [ |
| 328 | 'type' => 'string', |
| 329 | 'default' => 'pagination', |
| 330 | ], |
| 331 | |
| 332 | 'ajax_pagination_type' => [ |
| 333 | 'type' => 'string', |
| 334 | 'default' => '', |
| 335 | ], |
| 336 | |
| 337 | 'load_more_button_text' => [ |
| 338 | 'type' => 'string', |
| 339 | 'default' => 'Load More', |
| 340 | ], |
| 341 | |
| 342 | // Links. |
| 343 | |
| 344 | 'post_link_type' => [ |
| 345 | 'type' => 'string', |
| 346 | 'default' => 'default', |
| 347 | ], |
| 348 | |
| 349 | 'link_target' => [ |
| 350 | 'type' => 'string', |
| 351 | 'default' => '_self', |
| 352 | ], |
| 353 | |
| 354 | 'is_thumb_linked' => [ |
| 355 | 'type' => 'string', |
| 356 | 'default' => 'yes', |
| 357 | ], |
| 358 | |
| 359 | 'pagination_btn_position' => [ |
| 360 | 'type' => 'string', |
| 361 | 'default' => '', |
| 362 | 'style' => [ |
| 363 | (object) [ |
| 364 | 'selector' => '{{RTTPG}} .rt-pagination-wrap {position: {{pagination_btn_position}};margin:0;}', |
| 365 | ], |
| 366 | ], |
| 367 | ], |
| 368 | |
| 369 | 'pagination_pos_val' => [ |
| 370 | 'type' => 'object', |
| 371 | 'default' => (object) [ |
| 372 | 'lg' => '', |
| 373 | 'md' => '', |
| 374 | 'sm' => '', |
| 375 | ], |
| 376 | 'style' => [ |
| 377 | (object) [ |
| 378 | 'selector' => '{{RTTPG}} .rt-pagination-wrap{top:{{pagination_pos_val}};}', |
| 379 | ], |
| 380 | ], |
| 381 | ], |
| 382 | |
| 383 | 'pagination_pos_val_left' => [ |
| 384 | 'type' => 'object', |
| 385 | 'default' => (object) [ |
| 386 | 'lg' => '', |
| 387 | 'md' => '', |
| 388 | 'sm' => '', |
| 389 | ], |
| 390 | 'style' => [ |
| 391 | (object) [ |
| 392 | 'selector' => '{{RTTPG}} .rt-pagination-wrap{left:{{pagination_pos_val_left}};}', |
| 393 | ], |
| 394 | ], |
| 395 | ], |
| 396 | |
| 397 | 'pagination_btn_space_btween' => [ |
| 398 | 'type' => 'string', |
| 399 | 'default' => '', |
| 400 | ], |
| 401 | ]; |
| 402 | |
| 403 | $post_types = Fns::get_post_types(); |
| 404 | |
| 405 | // Field Selections. |
| 406 | |
| 407 | $cf = Fns::is_acf(); |
| 408 | if ( $cf && rtTPG()->hasPro() ) { |
| 409 | $content_attribute['show_acf'] = [ |
| 410 | 'type' => 'string', |
| 411 | 'default' => '', |
| 412 | ]; |
| 413 | |
| 414 | foreach ( $post_types as $post_type => $post_type_title ) { |
| 415 | $get_acf_field = Fns::get_groups_by_post_type( $post_type ); |
| 416 | $selected_acf_id = ''; |
| 417 | if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) { |
| 418 | $selected_acf_id = array_key_first( $get_acf_field ); |
| 419 | } |
| 420 | |
| 421 | $content_attribute[ $post_type . '_cf_group' ] = [ |
| 422 | 'type' => 'string', |
| 423 | 'default' => '', |
| 424 | ]; |
| 425 | } |
| 426 | |
| 427 | $content_attribute['cf_hide_empty_value'] = [ |
| 428 | 'type' => 'string', |
| 429 | 'default' => 'yes', |
| 430 | ]; |
| 431 | $content_attribute['cf_hide_group_title'] = [ |
| 432 | 'type' => 'string', |
| 433 | 'default' => 'yes', |
| 434 | ]; |
| 435 | $content_attribute['cf_show_only_value'] = [ |
| 436 | 'type' => 'string', |
| 437 | 'default' => 'yes', |
| 438 | ]; |
| 439 | |
| 440 | } |
| 441 | |
| 442 | return apply_filters( 'rttpg_guten_content_attribute', $content_attribute ); |
| 443 | } |
| 444 | } |
| 445 |