Skip to content

Commit 32f94e7

Browse files
committed
add input compacting guide
1 parent c7318a5 commit 32f94e7

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Compacting input variables to fit within PHP's max_input_vars
2+
3+
In some cases forms can end up having hundreds of inputs which can cause the save request to exceed PHP's `max_input_vars` limit leading to lost request data. To combat this, Carbon Fields comes with a built-in support for input compacting which causes all inputs created by Carbon Fields to be sent as a single input var.
4+
5+
To enable input compacting please add the following near the top of your functions.php:
6+
```php
7+
// Enables input var compacting
8+
define( 'Carbon_Fields\\COMPACT_INPUT', true );
9+
10+
// Optionally overrides the compacted input name. You do not need this in most cases.
11+
define( 'Carbon_Field\\COMPACT_INPUT_KEY', 'my_custom_compacted_input_name' );
12+
```

documentation/1-guides/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ Carbon Fields - Docs
1313
* [Predefined Complex Groups](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/20-predefined-complex-groups.md)
1414
* [Sidebar Options](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/1-guides/30-sidebar-options.md)
1515
* [Serialized Datastore](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/50-serialized-datastore.md)
16-
* [Serialized Datastore](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/60-bedrock-support.md)
16+
* [Bedrock Support](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/60-bedrock-support.md)
17+
* [Compacting Input Vars](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation/70-compacting-input-vars.md)
1718

1819
---
1920

20-
**[< Back to Documentation Home](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation)**
21+
**[< Back to Documentation Home](https://github.com/htmlburger/carbon-fields-docs/tree/master/documentation)**

0 commit comments

Comments
 (0)