Skip to content
Snippets Groups Projects
Unverified Commit 379ebd46 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3495305 by phenaproxima: Recipes that depend on other recipes break RecipeInputFormTrait

(cherry picked from commit ac347da7)
parent 75edbfda
No related branches found
No related tags found
15 merge requests!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator
Pipeline #375304 passed
Pipeline: drupal

#375305

    ......@@ -25,11 +25,11 @@ final class InputConfigurator {
    private array $data = [];
    /**
    * The collected input values, or NULL if none have been collected yet.
    * The collected input values.
    *
    * @var mixed[]|null
    * @var mixed[]
    */
    private ?array $values = NULL;
    private array $values = [];
    /**
    * @param array<string, array<string, mixed>> $definitions
    ......@@ -96,7 +96,7 @@ public function getDataDefinitions(): array {
    * The collected input values, keyed by name.
    */
    public function getValues(): array {
    return $this->values ?? [];
    return $this->values;
    }
    /**
    ......@@ -131,13 +131,15 @@ public function describeAll(): array {
    * @throws \Symfony\Component\Validator\Exception\ValidationFailedException
    * Thrown if any of the collected values violate their validation
    * constraints.
    * @throws \LogicException
    * Thrown if input values have already been collected for this recipe.
    */
    public function collectAll(InputCollectorInterface $collector, array &$processed = []): void {
    // Don't bother collecting values for a recipe we've already seen.
    if (in_array($this->prefix, $processed, TRUE)) {
    return;
    }
    if (is_array($this->values)) {
    if ($this->values) {
    throw new \LogicException('Input values cannot be changed once they have been set.');
    }
    // First, collect values for the recipe's dependencies.
    ......@@ -146,7 +148,6 @@ public function collectAll(InputCollectorInterface $collector, array &$processed
    $dependency->input->collectAll($collector, $processed);
    }
    $this->values = [];
    foreach ($this->data as $key => $data) {
    $definition = $data->getDataDefinition();
    ......
    ......@@ -39,6 +39,7 @@ public function testRecipeInputViaForm(): void {
    // All recipe inputs are required, except for checkboxes, for which that
    // behavior makes no sense.
    $this->submitForm(['input_test[owner]' => ''], 'Apply recipe');
    $assert_session->statusCodeEquals(200);
    $assert_session->statusMessageContains("Site owner's name field is required.", 'error');
    $assert_session->statusMessageNotContains('Allow mischief field is required.', 'error');
    // All inputs should be validated with their own constraints.
    ......
    name: Input Test
    recipes:
    # Depend on another recipe in order to prove that we can collect input
    # from recipes that depend on other recipes.
    - no_extensions
    input:
    owner:
    data_type: string
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment