Complex classes like PodsForm 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 PodsForm, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 6 | class PodsForm { |
||
|
|
|||
| 7 | |||
| 8 | /** |
||
| 9 | * @var PodsForm |
||
| 10 | */ |
||
| 11 | protected static $instance = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | public static $field = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public static $field_group = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | public static $field_type = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var array |
||
| 30 | */ |
||
| 31 | public static $field_types = array(); |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | public static $loaded = array(); |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var int |
||
| 40 | */ |
||
| 41 | public static $form_counter = 0; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Singleton handling for a basic pods_form() request |
||
| 45 | * |
||
| 46 | * @return \PodsForm |
||
| 47 | * |
||
| 48 | * @since 2.3.5 |
||
| 49 | */ |
||
| 50 | public static function init() { |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Master handler for all field / form methods |
||
| 61 | * |
||
| 62 | * @return \PodsForm |
||
| 63 | * |
||
| 64 | * @license http://www.gnu.org/licenses/gpl-2.0.html |
||
| 65 | * @since 2.0 |
||
| 66 | */ |
||
| 67 | private function __construct() { |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Prevent clones |
||
| 74 | * |
||
| 75 | * @since 2.3 |
||
| 76 | */ |
||
| 77 | private function __clone() { |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Output a field's label |
||
| 83 | * |
||
| 84 | * @since 2.0 |
||
| 85 | */ |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Output a field's label |
||
| 89 | * |
||
| 90 | * @param string $name Field name |
||
| 91 | * @param string $label Label text |
||
| 92 | * @param string $help Help text |
||
| 93 | * @param array $options Field options |
||
| 94 | * |
||
| 95 | * @return string Label HTML |
||
| 96 | * |
||
| 97 | * @since 2.0 |
||
| 98 | */ |
||
| 99 | public static function label( $name, $label, $help = '', $options = null ) { |
||
| 134 | |||
| 135 | /** |
||
| 136 | * Output a Field Comment Paragraph |
||
| 137 | * |
||
| 138 | * @param string $name Field name |
||
| 139 | * @param string $message Field comments |
||
| 140 | * @param array $options Field options |
||
| 141 | * |
||
| 142 | * @return string Comment HTML |
||
| 143 | * |
||
| 144 | * @since 2.0 |
||
| 145 | */ |
||
| 146 | public static function comment( $name, $message = null, $options = null ) { |
||
| 173 | |||
| 174 | /** |
||
| 175 | * Output a field |
||
| 176 | * |
||
| 177 | * @param string $name Field name |
||
| 178 | * @param mixed $value Field value |
||
| 179 | * @param string $type Field type |
||
| 180 | * @param array $options Field options |
||
| 181 | * @param array $pod Pod data |
||
| 182 | * @param int $id Item ID |
||
| 183 | * |
||
| 184 | * @return string Field HTML |
||
| 185 | * |
||
| 186 | * @since 2.0 |
||
| 187 | */ |
||
| 188 | public static function field( $name, $value, $type = 'text', $options = null, $pod = null, $id = null ) { |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Output field type 'db' |
||
| 295 | * |
||
| 296 | * Used for field names and other places where only [a-z0-9_] is accepted |
||
| 297 | * |
||
| 298 | * @since 2.0 |
||
| 299 | * |
||
| 300 | * @param $name |
||
| 301 | * @param null $value |
||
| 302 | * @param null $options |
||
| 303 | * |
||
| 304 | * @return mixed|void |
||
| 305 | */ |
||
| 306 | protected static function field_db( $name, $value = null, $options = null ) { |
||
| 307 | |||
| 308 | $form_field_type = self::$field_type; |
||
| 309 | |||
| 310 | ob_start(); |
||
| 311 | |||
| 312 | pods_view( PODS_DIR . 'ui/fields/_db.php', compact( array_keys( get_defined_vars() ) ) ); |
||
| 313 | |||
| 314 | $output = ob_get_clean(); |
||
| 315 | |||
| 316 | return apply_filters( 'pods_form_ui_field_db', $output, $name, $value, $options ); |
||
| 317 | } |
||
| 318 | |||
| 319 | /** |
||
| 320 | * Output a hidden field |
||
| 321 | * |
||
| 322 | * @param $name |
||
| 323 | * @param null $value |
||
| 324 | * @param null $options |
||
| 325 | * |
||
| 326 | * @return mixed|void |
||
| 327 | */ |
||
| 328 | protected static function field_hidden( $name, $value = null, $options = null ) { |
||
| 329 | |||
| 330 | $form_field_type = self::$field_type; |
||
| 331 | |||
| 332 | ob_start(); |
||
| 333 | |||
| 334 | pods_view( PODS_DIR . 'ui/fields/_hidden.php', compact( array_keys( get_defined_vars() ) ) ); |
||
| 335 | |||
| 336 | $output = ob_get_clean(); |
||
| 337 | |||
| 338 | return apply_filters( 'pods_form_ui_field_hidden', $output, $name, $value, $options ); |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * Returns a submit button, with provided text and appropriate class, copied from WP Core for use on the frontend |
||
| 343 | * |
||
| 344 | * @see get_submit_button |
||
| 345 | * |
||
| 346 | * @param string $text The text of the button (defaults to 'Save Changes') |
||
| 347 | * @param string $type The type of button. One of: primary, secondary, delete |
||
| 348 | * @param string $name The HTML name of the submit button. Defaults to "submit". If no id |
||
| 349 | * attribute is given in $other_attributes below, $name will be used as the |
||
| 350 | * button's id. |
||
| 351 | * @param bool $wrap True if the output button should be wrapped in a paragraph tag, |
||
| 352 | * false otherwise. Defaults to true |
||
| 353 | * @param array|string $other_attributes Other attributes that should be output with the button, |
||
| 354 | * mapping attributes to their values, such as array( 'tabindex' => '1' ). |
||
| 355 | * These attributes will be output as attribute="value", such as |
||
| 356 | * tabindex="1". |
||
| 357 | * Defaults to no other attributes. Other attributes can also be provided as |
||
| 358 | * a |
||
| 359 | * string such as 'tabindex="1"', though the array format is typically |
||
| 360 | * cleaner. |
||
| 361 | * |
||
| 362 | * @since 2.7 |
||
| 363 | * @return string |
||
| 364 | */ |
||
| 365 | public static function submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null ) { |
||
| 431 | |||
| 432 | /** |
||
| 433 | * Output a row (label, field, and comment) |
||
| 434 | * |
||
| 435 | * @param string $name Field name |
||
| 436 | * @param mixed $value Field value |
||
| 437 | * @param string $type Field type |
||
| 438 | * @param array $options Field options |
||
| 439 | * @param array $pod Pod data |
||
| 440 | * @param int $id Item ID |
||
| 441 | * |
||
| 442 | * @return string Row HTML |
||
| 443 | * |
||
| 444 | * @since 2.0 |
||
| 445 | */ |
||
| 446 | public static function row( $name, $value, $type = 'text', $options = null, $pod = null, $id = null ) { |
||
| 458 | |||
| 459 | /** |
||
| 460 | * Output a field's attributes |
||
| 461 | * |
||
| 462 | * @since 2.0 |
||
| 463 | * |
||
| 464 | * @param $attributes |
||
| 465 | * @param null $name |
||
| 466 | * @param null $type |
||
| 467 | * @param null $options |
||
| 468 | */ |
||
| 469 | public static function attributes( $attributes, $name = null, $type = null, $options = null ) { |
||
| 481 | |||
| 482 | /** |
||
| 483 | * Output a field's data (for use with jQuery) |
||
| 484 | * |
||
| 485 | * @since 2.0 |
||
| 486 | * |
||
| 487 | * @param $data |
||
| 488 | * @param null $name |
||
| 489 | * @param null $type |
||
| 490 | * @param null $options |
||
| 491 | */ |
||
| 492 | public static function data( $data, $name = null, $type = null, $options = null ) { |
||
| 510 | |||
| 511 | /** |
||
| 512 | * Merge attributes and handle classes |
||
| 513 | * |
||
| 514 | * @since 2.0 |
||
| 515 | * |
||
| 516 | * @param $attributes |
||
| 517 | * @param null $name |
||
| 518 | * @param null $type |
||
| 519 | * @param null $options |
||
| 520 | * @param string $classes |
||
| 521 | * |
||
| 522 | * @return array |
||
| 523 | */ |
||
| 524 | public static function merge_attributes( $attributes, $name = null, $type = null, $options = null, $classes = '' ) { |
||
| 525 | |||
| 526 | $options = (array) $options; |
||
| 527 | |||
| 528 | if ( ! in_array( $type, array( 'label', 'comment' ) ) ) { |
||
| 529 | $name_clean = self::clean( $name ); |
||
| 530 | $name_more_clean = self::clean( $name, true ); |
||
| 531 | $_attributes = array(); |
||
| 532 | $_attributes['name'] = $name; |
||
| 533 | $_attributes['data-name-clean'] = $name_more_clean; |
||
| 534 | |||
| 535 | if ( 0 < strlen( pods_v( 'label', $options, '' ) ) ) { |
||
| 536 | $_attributes['data-label'] = strip_tags( pods_v( 'label', $options ) ); |
||
| 537 | } |
||
| 538 | |||
| 539 | $_attributes['id'] = 'pods-form-ui-' . $name_clean . ( self::$form_counter > 1 ? '-' . self::$form_counter : '' ); |
||
| 540 | $_attributes['class'] = 'pods-form-ui-field pods-form-ui-field-type-' . $type . ' pods-form-ui-field-name-' . $name_more_clean; |
||
| 541 | |||
| 542 | if ( isset( $options['dependency'] ) && false !== $options['dependency'] ) { |
||
| 543 | $_attributes['class'] .= ' pods-dependent-toggle'; |
||
| 544 | } |
||
| 545 | |||
| 546 | $attributes = array_merge( $_attributes, (array) $attributes ); |
||
| 547 | |||
| 548 | if ( isset( $options['attributes'] ) && is_array( $options['attributes'] ) && ! empty( $options['attributes'] ) ) { |
||
| 549 | $attributes = array_merge( $attributes, $options['attributes'] ); |
||
| 550 | } |
||
| 551 | } elseif ( isset( $options[ $type . '_attributes' ] ) && is_array( $options[ $type . '_attributes' ] ) && ! empty( $options[ $type . '_attributes' ] ) ) { |
||
| 552 | $attributes = array_merge( $attributes, $options[ $type . '_attributes' ] ); |
||
| 553 | }//end if |
||
| 554 | |||
| 555 | if ( isset( $options['class'] ) && ! empty( $options['class'] ) ) { |
||
| 556 | if ( is_array( $options['class'] ) ) { |
||
| 557 | $options['class'] = implode( ' ', $options['class'] ); |
||
| 558 | } |
||
| 559 | |||
| 560 | $options['class'] = (string) $options['class']; |
||
| 561 | if ( isset( $attributes['class'] ) ) { |
||
| 562 | $attributes['class'] = $attributes['class'] . ' ' . $options['class']; |
||
| 563 | } else { |
||
| 564 | $attributes['class'] = $options['class']; |
||
| 565 | } |
||
| 566 | |||
| 567 | $attributes['class'] = trim( $attributes['class'] ); |
||
| 568 | } |
||
| 569 | |||
| 570 | if ( ! empty( $classes ) ) { |
||
| 571 | if ( isset( $attributes['class'] ) ) { |
||
| 572 | $attributes['class'] = $attributes['class'] . ' ' . $classes; |
||
| 573 | } else { |
||
| 574 | $attributes['class'] = $classes; |
||
| 575 | } |
||
| 576 | } |
||
| 577 | |||
| 578 | $placeholder = trim( pods_v( 'placeholder', $options, pods_v( $type . '_placeholder', $options ) ) ); |
||
| 579 | |||
| 580 | if ( ! empty( $placeholder ) ) { |
||
| 581 | $attributes['placeholder'] = $placeholder; |
||
| 582 | } |
||
| 583 | |||
| 584 | if ( 1 === (int) pods_v( 'required', $options, 0 ) ) { |
||
| 585 | $attributes['class'] .= ' pods-validate pods-validate-required'; |
||
| 586 | } |
||
| 587 | |||
| 588 | $max_length = (int) pods_v( 'maxlength', $options, pods_v( $type . '_max_length', $options, 0 ) ); |
||
| 589 | |||
| 590 | if ( 0 < $max_length ) { |
||
| 591 | $attributes['maxlength'] = $max_length; |
||
| 592 | } |
||
| 593 | |||
| 594 | $attributes = (array) apply_filters( 'pods_form_ui_field_' . $type . '_merge_attributes', $attributes, $name, $options ); |
||
| 595 | |||
| 596 | return $attributes; |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Setup options for a field and store them for later use |
||
| 601 | * |
||
| 602 | * @param $type |
||
| 603 | * @param $options |
||
| 604 | * |
||
| 605 | * @return array |
||
| 606 | * |
||
| 607 | * @static |
||
| 608 | * |
||
| 609 | * @since 2.0 |
||
| 610 | */ |
||
| 611 | public static function options( $type, $options ) { |
||
| 662 | |||
| 663 | /** |
||
| 664 | * Get options for a field type and setup defaults |
||
| 665 | * |
||
| 666 | * @static |
||
| 667 | * |
||
| 668 | * @param $type |
||
| 669 | * |
||
| 670 | * @param null $options |
||
| 671 | * |
||
| 672 | * @return array|null |
||
| 673 | * @since 2.0 |
||
| 674 | */ |
||
| 675 | public static function options_setup( $type = null, $options = null ) { |
||
| 724 | |||
| 725 | /** |
||
| 726 | * Get Admin options for a field type and setup defaults |
||
| 727 | * |
||
| 728 | * @static |
||
| 729 | * |
||
| 730 | * @param $type |
||
| 731 | * |
||
| 732 | * @return array|null |
||
| 733 | * |
||
| 734 | * @since 2.0 |
||
| 735 | */ |
||
| 736 | public static function ui_options( $type ) { |
||
| 773 | |||
| 774 | /** |
||
| 775 | * Get options for a field and setup defaults |
||
| 776 | * |
||
| 777 | * @param null $fields |
||
| 778 | * @param null $core_defaults |
||
| 779 | * @param bool $single |
||
| 780 | * |
||
| 781 | * @return array|null |
||
| 782 | * |
||
| 783 | * @static |
||
| 784 | * @since 2.0 |
||
| 785 | */ |
||
| 786 | public static function fields_setup( $fields = null, $core_defaults = null, $single = false ) { |
||
| 827 | |||
| 828 | /** |
||
| 829 | * Get options for a field and setup defaults |
||
| 830 | * |
||
| 831 | * @static |
||
| 832 | * |
||
| 833 | * @param null $field |
||
| 834 | * @param null $core_defaults |
||
| 835 | * @param null $type |
||
| 836 | * |
||
| 837 | * @return array|null |
||
| 838 | * |
||
| 839 | * @since 2.0 |
||
| 840 | */ |
||
| 841 | public static function field_setup( $field = null, $core_defaults = null, $type = null ) { |
||
| 904 | |||
| 905 | /** |
||
| 906 | * Setup dependency / exclusion classes |
||
| 907 | * |
||
| 908 | * @param array $options array( 'depends-on' => ..., 'excludes-on' => ...) |
||
| 909 | * @param string $prefix |
||
| 910 | * |
||
| 911 | * @return array |
||
| 912 | * @static |
||
| 913 | * @since 2.0 |
||
| 914 | */ |
||
| 915 | public static function dependencies( $options, $prefix = '' ) { |
||
| 981 | |||
| 982 | /** |
||
| 983 | * Change the value of the field |
||
| 984 | * |
||
| 985 | * @param $type |
||
| 986 | * @param mixed $value |
||
| 987 | * @param string $name |
||
| 988 | * @param array $options |
||
| 989 | * @param array $pod |
||
| 990 | * @param int $id |
||
| 991 | * @param array $traverse |
||
| 992 | * |
||
| 993 | * @return array|mixed|null|object |
||
| 994 | * @internal param array $fields |
||
| 995 | * @since 2.3 |
||
| 996 | */ |
||
| 997 | public static function value( $type, $value = null, $name = null, $options = null, $pod = null, $id = null, $traverse = null ) { |
||
| 1031 | |||
| 1032 | /** |
||
| 1033 | * Change the way the value of the field is displayed with Pods::get |
||
| 1034 | * |
||
| 1035 | * @param $type |
||
| 1036 | * @param mixed $value |
||
| 1037 | * @param string $name |
||
| 1038 | * @param array $options |
||
| 1039 | * @param array $pod |
||
| 1040 | * @param int $id |
||
| 1041 | * @param array $traverse |
||
| 1042 | * |
||
| 1043 | * @return array|mixed|null|void |
||
| 1044 | * @internal param array $fields |
||
| 1045 | * @since 2.0 |
||
| 1046 | */ |
||
| 1047 | public static function display( $type, $value = null, $name = null, $options = null, $pod = null, $id = null, $traverse = null ) { |
||
| 1096 | |||
| 1097 | /** |
||
| 1098 | * Setup regex for JS / PHP |
||
| 1099 | * |
||
| 1100 | * @static |
||
| 1101 | * |
||
| 1102 | * @param $type |
||
| 1103 | * @param $options |
||
| 1104 | * |
||
| 1105 | * @return mixed|void |
||
| 1106 | * @since 2.0 |
||
| 1107 | */ |
||
| 1108 | public static function regex( $type, $options ) { |
||
| 1122 | |||
| 1123 | /** |
||
| 1124 | * Setup value preparation for sprintf |
||
| 1125 | * |
||
| 1126 | * @static |
||
| 1127 | * |
||
| 1128 | * @param $type |
||
| 1129 | * @param $options |
||
| 1130 | * |
||
| 1131 | * @return mixed|void |
||
| 1132 | * @since 2.0 |
||
| 1133 | */ |
||
| 1134 | public static function prepare( $type, $options ) { |
||
| 1148 | |||
| 1149 | /** |
||
| 1150 | * Validate a value before it's saved |
||
| 1151 | * |
||
| 1152 | * @param string $type |
||
| 1153 | * @param mixed $value |
||
| 1154 | * @param string $name |
||
| 1155 | * @param array $options |
||
| 1156 | * @param array $fields |
||
| 1157 | * @param array $pod |
||
| 1158 | * @param int $id |
||
| 1159 | * @param array|object $params |
||
| 1160 | * |
||
| 1161 | * @static |
||
| 1162 | * |
||
| 1163 | * @since 2.0 |
||
| 1164 | * @return bool|mixed|void |
||
| 1165 | */ |
||
| 1166 | public static function validate( $type, $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
||
| 1180 | |||
| 1181 | /** |
||
| 1182 | * Change the value or perform actions after validation but before saving to the DB |
||
| 1183 | * |
||
| 1184 | * @param string $type |
||
| 1185 | * @param mixed $value |
||
| 1186 | * @param int $id |
||
| 1187 | * @param string $name |
||
| 1188 | * @param array $options |
||
| 1189 | * @param array $fields |
||
| 1190 | * @param array $pod |
||
| 1191 | * @param object $params |
||
| 1192 | * |
||
| 1193 | * @static |
||
| 1194 | * |
||
| 1195 | * @since 2.0 |
||
| 1196 | * @return mixed |
||
| 1197 | */ |
||
| 1198 | public static function pre_save( $type, $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) { |
||
| 1208 | |||
| 1209 | /** |
||
| 1210 | * Save the value to the DB |
||
| 1211 | * |
||
| 1212 | * @param string $type |
||
| 1213 | * @param mixed $value |
||
| 1214 | * @param int $id |
||
| 1215 | * @param string $name |
||
| 1216 | * @param array $options |
||
| 1217 | * @param array $fields |
||
| 1218 | * @param array $pod |
||
| 1219 | * @param object $params |
||
| 1220 | * |
||
| 1221 | * @static |
||
| 1222 | * |
||
| 1223 | * @since 2.3 |
||
| 1224 | * @return null |
||
| 1225 | */ |
||
| 1226 | public static function save( $type, $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) { |
||
| 1238 | |||
| 1239 | /** |
||
| 1240 | * Delete the value from the DB |
||
| 1241 | * |
||
| 1242 | * @param string $type |
||
| 1243 | * @param int $id |
||
| 1244 | * @param string $name |
||
| 1245 | * @param array $options |
||
| 1246 | * @param array $pod |
||
| 1247 | * |
||
| 1248 | * @static |
||
| 1249 | * |
||
| 1250 | * @since 2.3 |
||
| 1251 | * @return null |
||
| 1252 | */ |
||
| 1253 | public static function delete( $type, $id = null, $name = null, $options = null, $pod = null ) { |
||
| 1265 | |||
| 1266 | /** |
||
| 1267 | * Check if a user has permission to be editing a field |
||
| 1268 | * |
||
| 1269 | * @param $type |
||
| 1270 | * @param null $name |
||
| 1271 | * @param null $options |
||
| 1272 | * @param null $fields |
||
| 1273 | * @param null $pod |
||
| 1274 | * @param null $id |
||
| 1275 | * @param null $params |
||
| 1276 | * |
||
| 1277 | * @static |
||
| 1278 | * |
||
| 1279 | * @since 2.0 |
||
| 1280 | * @return bool |
||
| 1281 | */ |
||
| 1282 | public static function permission( $type, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
||
| 1290 | |||
| 1291 | /** |
||
| 1292 | * Parse the default the value |
||
| 1293 | * |
||
| 1294 | * @since 2.0 |
||
| 1295 | * |
||
| 1296 | * @param $value |
||
| 1297 | * @param string $type |
||
| 1298 | * @param null $name |
||
| 1299 | * @param null $options |
||
| 1300 | * @param null $pod |
||
| 1301 | * @param null $id |
||
| 1302 | * |
||
| 1303 | * @return mixed|void |
||
| 1304 | */ |
||
| 1305 | public static function default_value( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null ) { |
||
| 1335 | |||
| 1336 | /** |
||
| 1337 | * Clean a value for use in class / id |
||
| 1338 | * |
||
| 1339 | * @since 2.0 |
||
| 1340 | * |
||
| 1341 | * @param $input |
||
| 1342 | * @param bool $noarray |
||
| 1343 | * @param bool $db_field |
||
| 1344 | * |
||
| 1345 | * @return mixed|string |
||
| 1346 | */ |
||
| 1347 | public static function clean( $input, $noarray = false, $db_field = false ) { |
||
| 1378 | |||
| 1379 | /** |
||
| 1380 | * Run admin_init methods for each field type |
||
| 1381 | * |
||
| 1382 | * @since 2.3 |
||
| 1383 | */ |
||
| 1384 | public function admin_init() { |
||
| 1408 | |||
| 1409 | /** |
||
| 1410 | * Autoload a Field Type's class |
||
| 1411 | * |
||
| 1412 | * @param string $field_type Field Type indentifier |
||
| 1413 | * @param string $file The Field Type class file location |
||
| 1414 | * |
||
| 1415 | * @return string |
||
| 1416 | * @access public |
||
| 1417 | * @static |
||
| 1418 | * @since 2.0 |
||
| 1419 | */ |
||
| 1420 | public static function field_loader( $field_type, $file = '' ) { |
||
| 1479 | |||
| 1480 | /** |
||
| 1481 | * Run a method from a Field Type's class |
||
| 1482 | * |
||
| 1483 | * @return mixed |
||
| 1484 | * @internal param string $field_type Field Type indentifier |
||
| 1485 | * @internal param string $method Method name |
||
| 1486 | * @internal param mixed $arg More arguments |
||
| 1487 | * |
||
| 1488 | * @access public |
||
| 1489 | * @static |
||
| 1490 | * @since 2.0 |
||
| 1491 | */ |
||
| 1492 | public static function field_method() { |
||
| 1511 | |||
| 1512 | /** |
||
| 1513 | * Add a new Pod field type |
||
| 1514 | * |
||
| 1515 | * @param string $type The new field type identifier |
||
| 1516 | * @param string $file The new field type class file location |
||
| 1517 | * |
||
| 1518 | * @return array Field Type data |
||
| 1519 | * |
||
| 1520 | * @since 2.3 |
||
| 1521 | */ |
||
| 1522 | public static function register_field_type( $type, $file = null ) { |
||
| 1541 | |||
| 1542 | /** |
||
| 1543 | * Get a list of all available field types and include |
||
| 1544 | * |
||
| 1545 | * @return array Registered Field Types data |
||
| 1546 | * |
||
| 1547 | * @since 2.3 |
||
| 1548 | */ |
||
| 1549 | public static function field_types() { |
||
| 1614 | |||
| 1615 | /** |
||
| 1616 | * Get list of available tableless field types |
||
| 1617 | * |
||
| 1618 | * @return array Tableless field types |
||
| 1619 | * |
||
| 1620 | * @since 2.3 |
||
| 1621 | */ |
||
| 1622 | public static function tableless_field_types() { |
||
| 1640 | |||
| 1641 | /** |
||
| 1642 | * Get list of available file field types |
||
| 1643 | * |
||
| 1644 | * @return array File field types |
||
| 1645 | * |
||
| 1646 | * @since 2.3 |
||
| 1647 | */ |
||
| 1648 | public static function file_field_types() { |
||
| 1660 | |||
| 1661 | /** |
||
| 1662 | * Get list of available repeatable field types |
||
| 1663 | * |
||
| 1664 | * @return array Repeatable field types |
||
| 1665 | * |
||
| 1666 | * @since 2.3 |
||
| 1667 | */ |
||
| 1668 | public static function repeatable_field_types() { |
||
| 1694 | |||
| 1695 | /** |
||
| 1696 | * Get list of available number field types |
||
| 1697 | * |
||
| 1698 | * @return array Number field types |
||
| 1699 | * |
||
| 1700 | * @since 2.3 |
||
| 1701 | */ |
||
| 1702 | public static function number_field_types() { |
||
| 1714 | |||
| 1715 | /** |
||
| 1716 | * Get list of available date field types |
||
| 1717 | * |
||
| 1718 | * @return array Date field types |
||
| 1719 | * |
||
| 1720 | * @since 2.3 |
||
| 1721 | */ |
||
| 1722 | public static function date_field_types() { |
||
| 1734 | |||
| 1735 | /** |
||
| 1736 | * Get list of available text field types |
||
| 1737 | * |
||
| 1738 | * @return array Text field types |
||
| 1739 | * |
||
| 1740 | * @since 2.3 |
||
| 1741 | */ |
||
| 1742 | public static function text_field_types() { |
||
| 1754 | |||
| 1755 | /** |
||
| 1756 | * Get list of available text field types |
||
| 1757 | * |
||
| 1758 | * @return array Text field types |
||
| 1759 | * |
||
| 1760 | * @since 2.3 |
||
| 1761 | */ |
||
| 1762 | public static function block_field_types() { |
||
| 1782 | |||
| 1783 | /** |
||
| 1784 | * Get list of available text field types |
||
| 1785 | * |
||
| 1786 | * @return array Text field types |
||
| 1787 | * |
||
| 1788 | * @since 2.3 |
||
| 1789 | */ |
||
| 1790 | public static function simple_tableless_objects() { |
||
| 1800 | |||
| 1801 | } |
||
| 1802 |