sortOptions example

$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;
    }

    /** * @param array<string, mixed> $data * * @return Group */
$this->sortSubmit($form$form_state);
    if (!empty($this->options['exposed'])) {
      $this->submitExposeForm($form$form_state);
    }
  }

  /** * Shortcut to display the value form. */
  protected function showSortForm(&$form, FormStateInterface $form_state) {
    $options = $this->sortOptions();
    if (!empty($options)) {
      $form['order'] = [
        '#title' => $this->t('Order', []['context' => 'Sort order']),
        '#type' => 'radios',
        '#options' => $options,
        '#default_value' => $this->options['order'],
      ];
    }
  }

  protected function sortValidate(&$form, FormStateInterface $form_state) {}

  
if ($options['show_deprecated']) {
            $this->filterOptionsByDeprecated($resolvedFormType);
        }

        $formOptions = [
            'own' => $this->ownOptions,
            'overridden' => $this->overriddenOptions,
            'parent' => $this->parentOptions,
            'extension' => $this->extensionOptions,
            'required' => $this->requiredOptions,
        ];
        $this->sortOptions($formOptions);

        $data = [
            'class' => $resolvedFormType->getInnerType()::class,
            'block_prefix' => $resolvedFormType->getInnerType()->getBlockPrefix(),
            'options' => $formOptions,
            'parent_types' => $this->parents,
            'type_extensions' => $this->extensions,
        ];

        $this->writeData($data$options);
    }

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