本文整理汇总了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));
}