public function FacetListBuilder::submitForm in Facets 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides DraggableListBuilder::submitForm
File
- src/
FacetListBuilder.php, line 323
Class
- FacetListBuilder
- Builds a listing of facet entities.
Namespace
Drupal\facetsCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$entities = $this->storage
->loadMultiple(array_keys($form_state
->getValue('facets')));
/** @var \Drupal\block\BlockInterface[] $entities */
foreach ($entities as $entity_id => $entity) {
$entity_values = $form_state
->getValue([
'facets',
$entity_id,
]);
$entity
->setWeight($entity_values['weight']);
$entity
->save();
}
\Drupal::messenger()
->addMessage(t('The facets have been updated.'));
}