[Form] Form::isPostMaxSizeReached() only triggers for root forms
This commit is contained in:
parent
4fcb98547c
commit
7680657944
@ -241,6 +241,16 @@ class Field extends Configurable implements FieldInterface
|
|||||||
return $this->parent;
|
return $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the field has a parent.
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function hasParent()
|
||||||
|
{
|
||||||
|
return null !== $this->parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root of the form tree
|
* Returns the root of the form tree
|
||||||
*
|
*
|
||||||
@ -251,6 +261,16 @@ class Field extends Configurable implements FieldInterface
|
|||||||
return $this->parent ? $this->parent->getRoot() : $this;
|
return $this->parent ? $this->parent->getRoot() : $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the field is the root of the form tree
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function isRoot()
|
||||||
|
{
|
||||||
|
return !$this->hasParent();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the field with default data
|
* Updates the field with default data
|
||||||
*
|
*
|
||||||
|
@ -235,7 +235,7 @@ class Form extends FieldGroup
|
|||||||
*/
|
*/
|
||||||
public function isPostMaxSizeReached()
|
public function isPostMaxSizeReached()
|
||||||
{
|
{
|
||||||
if (isset($_SERVER['CONTENT_LENGTH'])) {
|
if ($this->isRoot() && isset($_SERVER['CONTENT_LENGTH'])) {
|
||||||
$length = (int) $_SERVER['CONTENT_LENGTH'];
|
$length = (int) $_SERVER['CONTENT_LENGTH'];
|
||||||
$max = trim(ini_get('post_max_size'));
|
$max = trim(ini_get('post_max_size'));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user