Complex classes like GravityView_frontend often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GravityView_frontend, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 15 | class GravityView_frontend { |
||
|
|
|||
| 16 | |||
| 17 | /** |
||
| 18 | * Regex strings that are used to determine whether the current request is a GravityView search or not. |
||
| 19 | * @see GravityView_frontend::is_searching() |
||
| 20 | * @since 1.7.4.1 |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | private static $search_parameters = array( 'gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*' ); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Is the currently viewed post a `gravityview` post type? |
||
| 27 | * @var boolean |
||
| 28 | */ |
||
| 29 | var $is_gravityview_post_type = false; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Does the current post have a `[gravityview]` shortcode? |
||
| 33 | * @var boolean |
||
| 34 | */ |
||
| 35 | var $post_has_shortcode = false; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * The Post ID of the currently viewed post. Not necessarily GV |
||
| 39 | * @var int |
||
| 40 | */ |
||
| 41 | var $post_id = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Are we currently viewing a single entry? |
||
| 45 | * If so, the int value of the entry ID. Otherwise, false. |
||
| 46 | * @var int|boolean |
||
| 47 | */ |
||
| 48 | var $single_entry = false; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * If we are viewing a single entry, the entry data |
||
| 52 | * @var array|false |
||
| 53 | */ |
||
| 54 | var $entry = false; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * When displaying the single entry we should always know to which View it belongs (the context is everything!) |
||
| 58 | * @var null |
||
| 59 | */ |
||
| 60 | var $context_view_id = null; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * The View is showing search results |
||
| 64 | * @since 1.5.4 |
||
| 65 | * @var boolean |
||
| 66 | */ |
||
| 67 | var $is_search = false; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * The view data parsed from the $post |
||
| 71 | * |
||
| 72 | * @see GravityView_View_Data::__construct() |
||
| 73 | * @var GravityView_View_Data |
||
| 74 | */ |
||
| 75 | var $gv_output_data = null; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var GravityView_frontend |
||
| 79 | */ |
||
| 80 | static $instance; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Class constructor, enforce Singleton pattern |
||
| 84 | */ |
||
| 85 | private function __construct() {} |
||
| 86 | |||
| 87 | 36 | private function initialize() { |
|
| 103 | |||
| 104 | /** |
||
| 105 | * Get the one true instantiated self |
||
| 106 | * @return GravityView_frontend |
||
| 107 | */ |
||
| 108 | 42 | public static function getInstance() { |
|
| 117 | |||
| 118 | /** |
||
| 119 | * @return GravityView_View_Data |
||
| 120 | */ |
||
| 121 | 36 | public function getGvOutputData() { |
|
| 124 | |||
| 125 | /** |
||
| 126 | * @param \GravityView_View_Data $gv_output_data |
||
| 127 | */ |
||
| 128 | 36 | public function setGvOutputData( $gv_output_data ) { |
|
| 131 | |||
| 132 | /** |
||
| 133 | * @return boolean |
||
| 134 | */ |
||
| 135 | 35 | public function isSearch() { |
|
| 138 | |||
| 139 | /** |
||
| 140 | * @param boolean $is_search |
||
| 141 | */ |
||
| 142 | 36 | public function setIsSearch( $is_search ) { |
|
| 145 | |||
| 146 | /** |
||
| 147 | * @return bool|int |
||
| 148 | */ |
||
| 149 | 49 | public function getSingleEntry() { |
|
| 152 | |||
| 153 | /** |
||
| 154 | * Sets the single entry ID and also the entry |
||
| 155 | * @param bool|int|string $single_entry |
||
| 156 | */ |
||
| 157 | 35 | public function setSingleEntry( $single_entry ) { |
|
| 162 | |||
| 163 | /** |
||
| 164 | * @return array |
||
| 165 | */ |
||
| 166 | 43 | public function getEntry() { |
|
| 169 | |||
| 170 | /** |
||
| 171 | * Set the current entry |
||
| 172 | * @param array|int $entry Entry array or entry slug or ID |
||
| 173 | */ |
||
| 174 | 35 | public function setEntry( $entry ) { |
|
| 182 | |||
| 183 | /** |
||
| 184 | * @return int |
||
| 185 | */ |
||
| 186 | 36 | public function getPostId() { |
|
| 189 | |||
| 190 | /** |
||
| 191 | * @param int $post_id |
||
| 192 | */ |
||
| 193 | 36 | public function setPostId( $post_id ) { |
|
| 196 | |||
| 197 | /** |
||
| 198 | * @return boolean |
||
| 199 | */ |
||
| 200 | 37 | public function isPostHasShortcode() { |
|
| 203 | |||
| 204 | /** |
||
| 205 | * @param boolean $post_has_shortcode |
||
| 206 | */ |
||
| 207 | 36 | public function setPostHasShortcode( $post_has_shortcode ) { |
|
| 210 | |||
| 211 | /** |
||
| 212 | * @return boolean |
||
| 213 | */ |
||
| 214 | 38 | public function isGravityviewPostType() { |
|
| 217 | |||
| 218 | /** |
||
| 219 | * @param boolean $is_gravityview_post_type |
||
| 220 | */ |
||
| 221 | 36 | public function setIsGravityviewPostType( $is_gravityview_post_type ) { |
|
| 224 | |||
| 225 | /** |
||
| 226 | * Set the context view ID used when page contains multiple embedded views or displaying the single entry view |
||
| 227 | * |
||
| 228 | * |
||
| 229 | * |
||
| 230 | * @param null $view_id |
||
| 231 | */ |
||
| 232 | 2 | public function set_context_view_id( $view_id = null ) { |
|
| 253 | |||
| 254 | /** |
||
| 255 | * Returns the the view_id context when page contains multiple embedded views or displaying single entry view |
||
| 256 | * |
||
| 257 | * @since 1.5.4 |
||
| 258 | * |
||
| 259 | * @return string |
||
| 260 | */ |
||
| 261 | 35 | public function get_context_view_id() { |
|
| 264 | |||
| 265 | /** |
||
| 266 | * Allow GravityView entry endpoints on the front page of a site |
||
| 267 | * |
||
| 268 | * @link https://core.trac.wordpress.org/ticket/23867 Fixes this core issue |
||
| 269 | * @link https://wordpress.org/plugins/cpt-on-front-page/ Code is based on this |
||
| 270 | * |
||
| 271 | * @since 1.17.3 |
||
| 272 | * |
||
| 273 | * @param WP_Query &$query (passed by reference) |
||
| 274 | * |
||
| 275 | * @return void |
||
| 276 | */ |
||
| 277 | 167 | public function parse_query_fix_frontpage( &$query ) { |
|
| 331 | |||
| 332 | /** |
||
| 333 | * Read the $post and process the View data inside |
||
| 334 | * @param array $wp Passed in the `wp` hook. Not used. |
||
| 335 | * @return void |
||
| 336 | */ |
||
| 337 | 1 | public function parse_content( $wp = array() ) { |
|
| 338 | 1 | global $post; |
|
| 339 | |||
| 340 | // If in admin and NOT AJAX request, get outta here. |
||
| 341 | 1 | if ( gravityview()->request->is_admin() ) { |
|
| 342 | return; |
||
| 343 | } |
||
| 344 | |||
| 345 | // Calculate requested Views |
||
| 346 | 1 | $this->setGvOutputData( GravityView_View_Data::getInstance( $post ) ); |
|
| 347 | |||
| 348 | // !important: we need to run this before getting single entry (to kick the advanced filter) |
||
| 349 | 1 | $this->set_context_view_id(); |
|
| 350 | |||
| 351 | 1 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
|
| 352 | |||
| 353 | 1 | $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 354 | 1 | $this->setPostId( $post_id ); |
|
| 355 | 1 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
|
| 356 | 1 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
|
| 357 | |||
| 358 | // check if the View is showing search results (only for multiple entries View) |
||
| 359 | 1 | $this->setIsSearch( $this->is_searching() ); |
|
| 360 | |||
| 361 | 1 | unset( $entry, $post_id, $post_has_shortcode ); |
|
| 362 | 1 | } |
|
| 363 | |||
| 364 | /** |
||
| 365 | * Set the entry |
||
| 366 | */ |
||
| 367 | function set_entry_data() { |
||
| 372 | |||
| 373 | /** |
||
| 374 | * Checks if the current View is presenting search results |
||
| 375 | * |
||
| 376 | * @since 1.5.4 |
||
| 377 | * |
||
| 378 | * @return boolean True: Yes, it's a search; False: No, not a search. |
||
| 379 | */ |
||
| 380 | 1 | function is_searching() { |
|
| 381 | |||
| 382 | // It's a single entry, not search |
||
| 383 | 1 | if ( $this->getSingleEntry() ) { |
|
| 384 | 1 | return false; |
|
| 385 | } |
||
| 386 | |||
| 387 | 1 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
|
| 388 | |||
| 389 | 1 | if( 'post' === $search_method ) { |
|
| 390 | $get = $_POST; |
||
| 391 | } else { |
||
| 392 | 1 | $get = $_GET; |
|
| 393 | } |
||
| 394 | |||
| 395 | // No $_GET parameters |
||
| 396 | 1 | if ( empty( $get ) || ! is_array( $get ) ) { |
|
| 397 | 1 | return false; |
|
| 398 | } |
||
| 399 | |||
| 400 | // Remove empty values |
||
| 401 | $get = array_filter( $get ); |
||
| 402 | |||
| 403 | // If the $_GET parameters are empty, it's no search. |
||
| 404 | if ( empty( $get ) ) { |
||
| 405 | return false; |
||
| 406 | } |
||
| 407 | |||
| 408 | $search_keys = array_keys( $get ); |
||
| 409 | |||
| 410 | $search_match = implode( '|', self::$search_parameters ); |
||
| 411 | |||
| 412 | foreach ( $search_keys as $search_key ) { |
||
| 413 | |||
| 414 | // Analyze the search key $_GET parameter and see if it matches known GV args |
||
| 415 | if ( preg_match( '/(' . $search_match . ')/i', $search_key ) ) { |
||
| 416 | return true; |
||
| 417 | } |
||
| 418 | } |
||
| 419 | |||
| 420 | return false; |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * Filter the title for the single entry view |
||
| 425 | * |
||
| 426 | * |
||
| 427 | * @param string $title current title |
||
| 428 | * @param int $passed_post_id Post ID |
||
| 429 | * @return string (modified) title |
||
| 430 | */ |
||
| 431 | 8 | public function single_entry_title( $title, $passed_post_id = null ) { |
|
| 492 | |||
| 493 | |||
| 494 | /** |
||
| 495 | * In case View post is called directly, insert the view in the post content |
||
| 496 | * |
||
| 497 | * @deprecated Use \GV\View::content() instead. |
||
| 498 | * |
||
| 499 | * @access public |
||
| 500 | * @static |
||
| 501 | * @param mixed $content |
||
| 502 | * @return string Add the View output into View CPT content |
||
| 503 | */ |
||
| 504 | 4 | public function insert_view_in_content( $content ) { |
|
| 508 | |||
| 509 | /** |
||
| 510 | * Disable comments on GravityView post types |
||
| 511 | * @param boolean $open existing status |
||
| 512 | * @param int $post_id Post ID |
||
| 513 | * @return boolean |
||
| 514 | */ |
||
| 515 | public function comments_open( $open, $post_id ) { |
||
| 531 | |||
| 532 | /** |
||
| 533 | * Display a warning when a View has not been configured |
||
| 534 | * |
||
| 535 | * @since 1.19.2 |
||
| 536 | * |
||
| 537 | * @param int $view_id The ID of the View currently being displayed |
||
| 538 | * |
||
| 539 | * @return void |
||
| 540 | */ |
||
| 541 | 2 | public function context_not_configured_warning( $view_id = 0 ) { |
|
| 579 | |||
| 580 | |||
| 581 | /** |
||
| 582 | * Core function to render a View based on a set of arguments |
||
| 583 | * |
||
| 584 | * @access public |
||
| 585 | * @static |
||
| 586 | * @param array $passed_args { |
||
| 587 | * |
||
| 588 | * Settings for rendering the View |
||
| 589 | * |
||
| 590 | * @type int $id View id |
||
| 591 | * @type int $page_size Number of entries to show per page |
||
| 592 | * @type string $sort_field Form field id to sort |
||
| 593 | * @type string $sort_direction Sorting direction ('ASC', 'DESC', or 'RAND') |
||
| 594 | * @type string $start_date - Ymd |
||
| 595 | * @type string $end_date - Ymd |
||
| 596 | * @type string $class - assign a html class to the view |
||
| 597 | * @type string $offset (optional) - This is the start point in the current data set (0 index based). |
||
| 598 | * } |
||
| 599 | * |
||
| 600 | * @deprecated Use \GV\View_Renderer |
||
| 601 | * |
||
| 602 | * @return string|null HTML output of a View, NULL if View isn't found |
||
| 603 | */ |
||
| 604 | 1 | public function render_view( $passed_args ) { |
|
| 629 | |||
| 630 | /** |
||
| 631 | * Process the start and end dates for a view - overrides values defined in shortcode (if needed) |
||
| 632 | * |
||
| 633 | * The `start_date` and `end_date` keys need to be in a format processable by GFFormsModel::get_date_range_where(), |
||
| 634 | * which uses \DateTime() format. |
||
| 635 | * |
||
| 636 | * You can set the `start_date` or `end_date` to any value allowed by {@link http://www.php.net//manual/en/function.strtotime.php strtotime()}, |
||
| 637 | * including strings like "now" or "-1 year" or "-3 days". |
||
| 638 | * |
||
| 639 | * @see GFFormsModel::get_date_range_where |
||
| 640 | * |
||
| 641 | * @param array $args View settings |
||
| 642 | * @param array $search_criteria Search being performed, if any |
||
| 643 | * @return array Modified `$search_criteria` array |
||
| 644 | */ |
||
| 645 | 62 | public static function process_search_dates( $args, $search_criteria = array() ) { |
|
| 711 | |||
| 712 | |||
| 713 | /** |
||
| 714 | * Process the approved only search criteria according to the View settings |
||
| 715 | * |
||
| 716 | * @param array $args View settings |
||
| 717 | * @param array $search_criteria Search being performed, if any |
||
| 718 | * @return array Modified `$search_criteria` array |
||
| 719 | */ |
||
| 720 | 61 | public static function process_search_only_approved( $args, $search_criteria ) { |
|
| 742 | |||
| 743 | |||
| 744 | /** |
||
| 745 | * Check if a certain entry is approved. |
||
| 746 | * |
||
| 747 | * If we pass the View settings ($args) it will check the 'show_only_approved' setting before |
||
| 748 | * checking the entry approved field, returning true if show_only_approved = false. |
||
| 749 | * |
||
| 750 | * @since 1.7 |
||
| 751 | * @since 1.18 Converted check to use GravityView_Entry_Approval_Status::is_approved |
||
| 752 | * |
||
| 753 | * @uses GravityView_Entry_Approval_Status::is_approved |
||
| 754 | * |
||
| 755 | * @param array $entry Entry object |
||
| 756 | * @param array $args View settings (optional) |
||
| 757 | * |
||
| 758 | * @return bool |
||
| 759 | */ |
||
| 760 | public static function is_entry_approved( $entry, $args = array() ) { |
||
| 777 | |||
| 778 | /** |
||
| 779 | * Parse search criteria for a entries search. |
||
| 780 | * |
||
| 781 | * array( |
||
| 782 | * 'search_field' => 1, // ID of the field |
||
| 783 | * 'search_value' => '', // Value of the field to search |
||
| 784 | * 'search_operator' => 'contains', // 'is', 'isnot', '>', '<', 'contains' |
||
| 785 | * 'show_only_approved' => 0 or 1 // Boolean |
||
| 786 | * ) |
||
| 787 | * |
||
| 788 | * @param array $args Array of args |
||
| 789 | * @param int $form_id Gravity Forms form ID |
||
| 790 | * @return array Array of search parameters, formatted in Gravity Forms mode, using `status` key set to "active" by default, `field_filters` array with `key`, `value` and `operator` keys. |
||
| 791 | */ |
||
| 792 | 62 | public static function get_search_criteria( $args, $form_id ) { |
|
| 850 | |||
| 851 | |||
| 852 | |||
| 853 | /** |
||
| 854 | * Core function to calculate View multi entries (directory) based on a set of arguments ($args): |
||
| 855 | * $id - View id |
||
| 856 | * $page_size - Page |
||
| 857 | * $sort_field - form field id to sort |
||
| 858 | * $sort_direction - ASC / DESC |
||
| 859 | * $start_date - Ymd |
||
| 860 | * $end_date - Ymd |
||
| 861 | * $class - assign a html class to the view |
||
| 862 | * $offset (optional) - This is the start point in the current data set (0 index based). |
||
| 863 | * |
||
| 864 | * |
||
| 865 | * |
||
| 866 | * @uses gravityview_get_entries() |
||
| 867 | * @access public |
||
| 868 | * @param array $args\n |
||
| 869 | * - $id - View id |
||
| 870 | * - $page_size - Page |
||
| 871 | * - $sort_field - form field id to sort |
||
| 872 | * - $sort_direction - ASC / DESC |
||
| 873 | * - $start_date - Ymd |
||
| 874 | * - $end_date - Ymd |
||
| 875 | * - $class - assign a html class to the view |
||
| 876 | * - $offset (optional) - This is the start point in the current data set (0 index based). |
||
| 877 | * @param int $form_id Gravity Forms Form ID |
||
| 878 | * @return array Associative array with `count`, `entries`, and `paging` keys. `count` has the total entries count, `entries` is an array with Gravity Forms full entry data, `paging` is an array with `offset` and `page_size` keys |
||
| 879 | */ |
||
| 880 | 1 | public static function get_view_entries( $args, $form_id ) { |
|
| 917 | |||
| 918 | /** |
||
| 919 | * Get an array of search parameters formatted as Gravity Forms requires |
||
| 920 | * |
||
| 921 | * Results are filtered by `gravityview_get_entries` and `gravityview_get_entries_{View ID}` filters |
||
| 922 | * |
||
| 923 | * @uses GravityView_frontend::get_search_criteria |
||
| 924 | * @uses GravityView_frontend::get_search_criteria_paging |
||
| 925 | * |
||
| 926 | * @since 1.20 |
||
| 927 | * |
||
| 928 | * @see \GV\View_Settings::defaults For $args options |
||
| 929 | * |
||
| 930 | * @param array $args Array of View settings, as structured in \GV\View_Settings::defaults |
||
| 931 | * @param int $form_id Gravity Forms form ID to search |
||
| 932 | * |
||
| 933 | * @return array With `search_criteria`, `sorting`, `paging`, `cache` keys |
||
| 934 | */ |
||
| 935 | 61 | public static function get_view_entries_parameters( $args = array(), $form_id = 0 ) { |
|
| 990 | |||
| 991 | /** |
||
| 992 | * Get the paging array for the View |
||
| 993 | * |
||
| 994 | * @since 1.19.5 |
||
| 995 | * |
||
| 996 | * @param $args |
||
| 997 | * @param int $form_id |
||
| 998 | */ |
||
| 999 | 61 | public static function get_search_criteria_paging( $args ) { |
|
| 1000 | |||
| 1001 | /** |
||
| 1002 | * @filter `gravityview_default_page_size` The default number of entries displayed in a View |
||
| 1003 | * @since 1.1.6 |
||
| 1004 | * @param int $default_page_size Default: 25 |
||
| 1005 | */ |
||
| 1006 | 61 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1007 | |||
| 1008 | // Paging & offset |
||
| 1009 | 61 | $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
| 1010 | |||
| 1011 | 61 | if ( -1 === $page_size ) { |
|
| 1012 | 1 | $page_size = PHP_INT_MAX; |
|
| 1013 | } |
||
| 1014 | |||
| 1015 | 61 | $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1016 | 61 | $offset = ( $curr_page - 1 ) * $page_size; |
|
| 1017 | |||
| 1018 | 61 | if ( ! empty( $args['offset'] ) ) { |
|
| 1019 | $offset += intval( $args['offset'] ); |
||
| 1020 | } |
||
| 1021 | |||
| 1022 | $paging = array( |
||
| 1023 | 61 | 'offset' => $offset, |
|
| 1024 | 61 | 'page_size' => $page_size, |
|
| 1025 | ); |
||
| 1026 | |||
| 1027 | 61 | gravityview()->log->debug( 'Paging: ', array( 'data' => $paging ) ); |
|
| 1028 | |||
| 1029 | 61 | return $paging; |
|
| 1030 | } |
||
| 1031 | |||
| 1032 | /** |
||
| 1033 | * Updates the View sorting criteria |
||
| 1034 | * |
||
| 1035 | * @since 1.7 |
||
| 1036 | * |
||
| 1037 | * @param array $args View settings. Required to have `sort_field` and `sort_direction` keys |
||
| 1038 | * @param int $form_id The ID of the form used to sort |
||
| 1039 | * @return array $sorting Array with `key`, `direction` and `is_numeric` keys |
||
| 1040 | */ |
||
| 1041 | 61 | public static function updateViewSorting( $args, $form_id ) { |
|
| 1102 | |||
| 1103 | /** |
||
| 1104 | * Override sorting per field |
||
| 1105 | * |
||
| 1106 | * Currently only modifies sorting ID when sorting by the full name. Sorts by first name. |
||
| 1107 | * Use the `gravityview/sorting/full-name` filter to override. |
||
| 1108 | * |
||
| 1109 | * @todo Filter from GravityView_Field |
||
| 1110 | * @since 1.7.4 |
||
| 1111 | * @internal Hi developer! Although this is public, don't call this method; we're going to replace it. |
||
| 1112 | * |
||
| 1113 | * @param int|string|array $sort_field_id Field used for sorting (`id` or `1.2`), or an array for multisorts |
||
| 1114 | * @param int $form_id GF Form ID |
||
| 1115 | * |
||
| 1116 | * @return string Possibly modified sorting ID |
||
| 1117 | */ |
||
| 1118 | 2 | public static function _override_sorting_id_by_field_type( $sort_field_id, $form_id ) { |
|
| 1214 | |||
| 1215 | /** |
||
| 1216 | * Verify if user requested a single entry view |
||
| 1217 | * @since 2.3.3 Added return null |
||
| 1218 | * @return boolean|string|null false if not, single entry slug if true, null if \GV\Entry doesn't exist yet |
||
| 1219 | */ |
||
| 1220 | 18 | public static function is_single_entry() { |
|
| 1249 | |||
| 1250 | |||
| 1251 | /** |
||
| 1252 | * Register styles and scripts |
||
| 1253 | * |
||
| 1254 | * @access public |
||
| 1255 | * @return void |
||
| 1256 | */ |
||
| 1257 | 1 | public function add_scripts_and_styles() { |
|
| 1345 | |||
| 1346 | /** |
||
| 1347 | * Handle enqueuing the `gravityview_default_style` stylesheet |
||
| 1348 | * |
||
| 1349 | * @since 1.17 |
||
| 1350 | * |
||
| 1351 | * @param array $css_dependencies Dependencies for the `gravityview_default_style` stylesheet |
||
| 1352 | * |
||
| 1353 | * @return void |
||
| 1354 | */ |
||
| 1355 | private function enqueue_default_style( $css_dependencies = array() ) { |
||
| 1372 | |||
| 1373 | /** |
||
| 1374 | * Add template extra style if exists |
||
| 1375 | * @param string $template_id |
||
| 1376 | */ |
||
| 1377 | public static function add_style( $template_id ) { |
||
| 1389 | |||
| 1390 | |||
| 1391 | /** |
||
| 1392 | * Inject the sorting links on the table columns |
||
| 1393 | * |
||
| 1394 | * Callback function for hook 'gravityview/template/field_label' |
||
| 1395 | * @see GravityView_API::field_label() (in includes/class-api.php) |
||
| 1396 | * |
||
| 1397 | * @since 1.7 |
||
| 1398 | * |
||
| 1399 | * @param string $label Field label |
||
| 1400 | * @param array $field Field settings |
||
| 1401 | * @param array $form Form object |
||
| 1402 | * |
||
| 1403 | * @return string Field Label |
||
| 1404 | */ |
||
| 1405 | public function add_columns_sort_links( $label = '', $field, $form ) { |
||
| 1448 | |||
| 1449 | /** |
||
| 1450 | * Checks if field (column) is sortable |
||
| 1451 | * |
||
| 1452 | * @param string $field Field settings |
||
| 1453 | * @param array $form Gravity Forms form array |
||
| 1454 | * |
||
| 1455 | * @since 1.7 |
||
| 1456 | * |
||
| 1457 | * @return bool True: Yes, field is sortable; False: not sortable |
||
| 1458 | */ |
||
| 1459 | public function is_field_sortable( $field_id = '', $form = array() ) { |
||
| 1489 | |||
| 1490 | } |
||
| 1491 | |||
| 1496 |