本文整理匯總了PHP中Drupal\Core\Form\FormStateInterface::setLimitValidationErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormStateInterface::setLimitValidationErrors方法的具體用法?PHP FormStateInterface::setLimitValidationErrors怎麽用?PHP FormStateInterface::setLimitValidationErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Form\FormStateInterface
的用法示例。
在下文中一共展示了FormStateInterface::setLimitValidationErrors方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setLimitValidationErrors
/**
* {@inheritdoc}
*/
public function setLimitValidationErrors($limit_validation_errors) {
$add_subkeys = function(array $path) {
return array_merge($this->subKeys, $path);
};
$limit_validation_errors = array_map($add_subkeys, $limit_validation_errors);
$this->mainFormState->setLimitValidationErrors($limit_validation_errors);
return $this;
}
示例2: validateRequiredFields
/**
* Validate callback for alt and title field, if the user wants them required.
*
* This is separated in a validate function instead of a #required flag to
* avoid being validated on the process callback.
*/
public static function validateRequiredFields($element, FormStateInterface $form_state)
{
// Only do validation if the function is triggered from other places than
// the image process form.
if (!in_array('file_managed_file_submit', $form_state->getTriggeringElement()['#submit'])) {
// If the image is not there, we do not check for empty values.
$parents = $element['#parents'];
$field = array_pop($parents);
$image_field = NestedArray::getValue($form_state->getUserInput(), $parents);
// We check for the array key, so that it can be NULL (like if the user
// submits the form without using the "upload" button).
if (!array_key_exists($field, $image_field)) {
return;
}
} else {
$form_state->setLimitValidationErrors([]);
}
}
示例3: setLimitValidationErrors
/**
* {@inheritdoc}
*/
public function setLimitValidationErrors($limit_validation_errors)
{
$this->decoratedFormState->setLimitValidationErrors($limit_validation_errors);
return $this;
}
示例4: testSetLimitValidationErrors
/**
* @covers ::setLimitValidationErrors
*
* @dataProvider providerLimitValidationErrors
*
* @param array[]|null $limit_validation_errors
* Any valid value for
* \Drupal\Core\Form\FormStateInterface::setLimitValidationErrors()'s
* $limit_validation_errors argument;
*/
public function testSetLimitValidationErrors($limit_validation_errors)
{
$this->decoratedFormState->setLimitValidationErrors($limit_validation_errors)->shouldBecalled();
$this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setLimitValidationErrors($limit_validation_errors));
}