setGroups example

$this->assertSame($executed$this->formStateDecoratorBase->isExecuted());
  }

  /** * @covers ::setGroups */
  public function testSetGroups() {
    $groups = [
      'FOO' => 'BAR',
    ];

    $this->decoratedFormState->setGroups($groups)
      ->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setGroups($groups));
  }

  /** * @covers ::getGroups */
  public function testGetGroups() {
    $groups = [
      'FOO' => 'BAR',
    ];
$group->fromArray($groupData);
            $allGroups[] = $group;
        }

        // Clear needed in order to allow updates on configuratorSet. When removed constraints in         // s_article_configurator_set_group_relations and s_article_configurator_set_option_relations         // might fail.         $configuratorSet->getOptions()->clear();
        $configuratorSet->setOptions($allOptions);
        $configuratorSet->getGroups()->clear();
        $configuratorSet->setGroups($allGroups);

        $this->getManager()->persist($configuratorSet);

        $data['configuratorSet'] = $configuratorSet;

        return $data;
    }

    /** * @param array<string, mixed> $data * * @throws CustomValidationException * * @return array<string, mixed> */
// Caching is normally done in self::processForm(), but what needs to be     // cached is the $form structure before it passes through     // self::doBuildForm(), so we need to do it here.     // @todo For Drupal 8, find a way to avoid this code duplication.     if ($form_state->isCached()) {
      $this->setCache($form['#build_id']$form$form_state);
    }

    // Clear out all group associations as these might be different when     // re-rendering the form.     $form_state->setGroups([]);

    // Return a fully built form that is ready for rendering.     return $this->doBuildForm($form_id$form$form_state);
  }

  /** * {@inheritdoc} */
  public function getCache($form_build_id, FormStateInterface $form_state) {
    return $this->formCache->getCache($form_build_id$form_state);
  }

  
/** * {@inheritdoc} */
  public function isExecuted() {
    return $this->decoratedFormState->isExecuted();
  }

  /** * {@inheritdoc} */
  public function setGroups(array $groups) {
    $this->decoratedFormState->setGroups($groups);

    return $this;
  }

  /** * {@inheritdoc} */
  public function DgetGroups() {
    return $this->decoratedFormState->getGroups();
  }

  
$set = $sets[$setId] ?? $this->hydrateSet($row);

            $groups = $set->getGroups();
            $group = $groups[$groupId] ?? $this->hydrateGroup($row);

            $options = $group->getOptions();
            $options[$optionId] = $this->hydrateOption($row);
            $groups[$groupId] = $group;
            $sets[$setId] = $set;

            $group->setOptions($options);
            $set->setGroups($groups);
        }

        foreach ($sets as $set) {
            foreach ($set->getGroups() as $group) {
                $options = $group->getOptions();
                $this->sortOptions($options$set->getSortMode());
                $group->setOptions($options);
            }
        }

        return $sets;
    }

        $this->attributeHydrator = $attributeHydrator;
        $this->mediaHydrator = $mediaHydrator;
    }

    /** * @return Set */
    public function hydrate(array $data)
    {
        $set = $this->createSet($data[0] ?? []);
        $set->setGroups($this->hydrateGroups($data));

        return $set;
    }

    /** * @return Group[] */
    public function hydrateGroups(array $data)
    {
        $groups = [];

        
Home | Imprint | This part of the site doesn't use cookies.