Get overrides

@param string $form_class
@return array
330205
public function getOverrides(string $form_class) : array {
		$form_class = '\\' . ltrim($form_class, '\\');
		return array_keys($this->data[$form_class] ?? []);
	}
475835
protected function get_role_override_id(string $prefix = '') : \stdClass {
        $fieldname = "{$prefix}id";

        $fielddata = (object) [
            'fields' => [],
        ];

        $fielddata->fields[] = $this->_form->createElement('hidden', $fieldname);
        $fielddata->types[$fieldname] = PARAM_INT;

        return $fielddata;
    }
1230415
public function getConfigOverrides()
    {
        if (! empty(ee()->config->config[$this->config_key]) && is_array(ee()->config->config[$this->config_key])) {
            return ee()->config->config[$this->config_key];
        }
        
        return array();
    }
1205033
protected function getFormConfiguration($form_id) {
    $form_configuration = [];

    if (isset($this->configuration['child_forms'][$form_id])) {
      $form_configuration = $this->configuration['child_forms'][$form_id];
    }

    return $form_configuration;
  }
1202063
public function getRowsByClass($class_name)
    {
        $rows = array();
        foreach ($this->extra_rows as $row) {
            if ($row instanceof $class_name) {
                $rows[] = $row;
            }
        }

        return $rows;
    }
114472
public function getFormOptions()
    {
        $submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t(__CLASS__.'.SUBMITBUTTON', 'Submit');
        $clear = ($this->ClearButtonText) ? $this->ClearButtonText : _t(__CLASS__.'.CLEARBUTTON', 'Clear');

        $options = FieldList::create(
            TextField::create('SubmitButtonText', _t(__CLASS__.'.TEXTONSUBMIT', 'Text on submit button:'), $submit),
            TextField::create('ClearButtonText', _t(__CLASS__.'.TEXTONCLEAR', 'Text on clear button:'), $clear),
            CheckboxField::create('ShowClearButton', _t(__CLASS__.'.SHOWCLEARFORM', 'Show Clear Form Button'), $this->ShowClearButton),
            CheckboxField::create('EnableLiveValidation', _t(__CLASS__.'.ENABLELIVEVALIDATION', 'Enable live validation')),
            CheckboxField::create('DisplayErrorMessagesAtTop', _t(__CLASS__.'.DISPLAYERRORMESSAGESATTOP', 'Display error messages above the form?')),
            CheckboxField::create('DisableCsrfSecurityToken', _t(__CLASS__.'.DISABLECSRFSECURITYTOKEN', 'Disable CSRF Token')),
            CheckboxField::create('DisableAuthenicatedFinishAction', _t(__CLASS__.'.DISABLEAUTHENICATEDFINISHACTION', 'Disable Authentication on finish action'))
        );

        $this->extend('updateFormOptions', $options);

        return $options;
    }
623979
private List<ClassInfo> getOverrideOrder() {
        if (overrideOrder == null) {
            overrideOrder = getOverrideOrder(new HashSet<ClassInfo>(), new ArrayList<ClassInfo>());
        }
        return overrideOrder;
    }
673887
public function getOverriddenMethodIds($method_id)
    {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        $class_storage = $this->classlike_storage_provider->get($fq_class_name);

        if (isset($class_storage->overridden_method_ids[$method_name])) {
            return $class_storage->overridden_method_ids[$method_name];
        }

        return [];
    }
611760
private function getAdultForm(array $form, FormStateInterface $form_state) {
    // Get steps for the form.
    $step = $form_state->getValue('step');
    if ($trigger = $form_state->getTriggeringElement()) {
      switch ($trigger['#name']) {
        case 'location':
          $step = 3;
          $this->clearForm(['program', 'category', 'rate', 'session'], $form_state);
          break;

        case 'category':
          $this->clearForm(['program', 'rate', 'session'], $form_state);
          $step = 4;
          break;

        case 'program':
          $this->clearForm(['rate', 'session'], $form_state);
          $step = 5;
          break;

        case 'session':
          $step = 6;
          break;
      }
      $form_state->setValue('step', $step);
    }

    // Locations.
    if ($form_state->getValue('step') >= 2) {
      $locations = $this->storage->getLocations();
      $options = array_filter($locations, [$this, 'filterLocations'], ARRAY_FILTER_USE_BOTH);
      if (empty($options)) {
        // Use all locations if user hasn't provided any filters.
        $options = $locations;
      }

      if (empty($options)) {
        return $this->noResults($form);
      }

      $form['location'] = [
        '#type' => 'radios',
        '#title' => $this->t('Location'),
        '#options' => $options,
        '#ajax' => $this->getAjaxDefaults(),
      ];
    }

    // Categories.
    if ($form_state->getValue('step') >= 3) {
      $categories = $this->storage->getCategoriesByBranch($form_state->getValue('location'));
      $items = array_filter($categories, [$this, 'filterCategories'], ARRAY_FILTER_USE_BOTH);
      if (empty($items)) {
        $items = $categories;
      }

      if (empty($categories)) {
        return $this->noResults($form);
      }

      $categories = [];
      foreach ($items as $item_id => $item_title) {
        $categories[$item_id] = $item_title;
      }

      $form['category'] = [
        '#type' => 'radios',
        '#title' => $this->t('Category'),
        '#options' => $categories,
        '#ajax' => $this->getAjaxDefaults(),
      ];
    }

    // Programs.
    if ($form_state->getValue('step') >= 4) {
      $items = $this->storage->getProgramsByBranchAndCategory($form_state->getValue('location'), $form_state->getValue('category'));
      if (empty($items)) {
        return $this->noResults($form);
      }

      $programs = [];
      foreach ($items as $item) {
        $programs[$item->id] = $item->name;
      }

      $form['program'] = [
        '#type' => 'radios',
        '#title' => $this->t('Program'),
        '#options' => $programs,
        '#ajax' => $this->getAjaxDefaults(),
      ];
    }

    if ($form_state->getValue('step') >= 5) {
      $items = $this->storage->getSessionsByProgramAndLocation($form_state->getValue('program'), $form_state->getValue('location'));
      if (empty($items)) {
        return $this->noResults($form);
      }

      $sessions = [];
      foreach ($items as $item) {
        $sessions[$item->id] = $item->name;
      }

      $form['session'] = [
        '#type' => 'radios',
        '#title' => $this->t('Session'),
        '#options' => $sessions,
        '#ajax' => $this->getAjaxDefaults(),
      ];
    }

    if ($form_state->getValue('step') >= 6) {
      $uri = $this->storage->getRegistrationLink($form_state->getValue('program'), $form_state->getValue('session'));
      $url = Url::fromUri($uri);
      $link = Link::fromTextAndUrl($this->t('link'), $url);

      $form['link'] = [
        '#type' => 'html_tag',
        '#tag' => 'div',
        '#attributes' => [
          'class' => 'result',
        ],
        '#value' => $this->t('Congrats! Here is your program registration %link!', ['%link' => $link->toString()]),
      ];
    }

    return $form;
  }
692185
public function getFormFields(): array
    {
        $properties = $this->getProperties();

        $fields = array_diff($properties, ['id']);

        $fieldsWithTypes = [];
        foreach ($fields as $field) {
            $fieldsWithTypes[$field] = null;
        }

        return $fieldsWithTypes;
    }
991263
protected function checkOverride($options)
    {
        if ($this->skip_override) {
            return null;
        }
        $base_class=isset($options['base_class'])?$options['base_class']:self::DEFAULT_OPTIONS['base_class'];
        $base_class=ltrim($base_class, '\\');
        
        if (!$base_class || !class_exists($base_class)) {
            return null;
        }
        if (static::class===$base_class) {
            return null;
        }
        return static::G($base_class::G());
    }
949782
public function getActionsOptions($override = false)
    {
        //make sure we only run this once and then return the cached version
        if (empty($this->actionsOptions) || $override) {
            $this->actionsOptions = array();

            //loop over the actions to build the list
            foreach ($this->getActions($override) as $name => $action) {
                $this->actionsOptions[] = $action->getOptions(true);
            }
        }

        return $this->actionsOptions;
    }
1128485
protected function getDefaultFormValues()
    {
        $result = parent::getDefaultFormValues();
        $result['send_mode'] = 'send_normal';
        if (!empty($this->screenLog)) {
            $result['log'] = implode("\n", $this->screenLog);
        }
        return $result;
    }
418107
protected function add_override_fields() {
        $purpose = $this->get_persistent();

        if (empty($purpose->get('id'))) {
            // It is not possible to use repeated elements in a modal form yet.
            return;
        }

        $fields = [
            $this->get_role_override_id('roleoverride_'),
            $this->get_role_field('roleoverride_'),
            $this->get_retention_period_fields('roleoverride_'),
            $this->get_protected_field('roleoverride_'),
            $this->get_lawful_base_field('roleoverride_'),
            $this->get_sensitive_base_field('roleoverride_'),
        ];

        $options = [
            'type' => [],
            'helpbutton' => [],
        ];

        // Start by adding the title.
        $overrideelements = [
            $this->_form->createElement('header', 'roleoverride', get_string('roleoverride', 'tool_dataprivacy')),
            $this->_form->createElement(
                'static',
                'roleoverrideoverview',
                '',
                get_string('roleoverrideoverview', 'tool_dataprivacy')
            ),
        ];

        foreach ($fields as $fielddata) {
            foreach ($fielddata->fields as $field) {
                $overrideelements[] = $field;
            }

            if (!empty($fielddata->helps)) {
                foreach ($fielddata->helps as $name => $help) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['helpbutton'] = $help;
                }
            }

            if (!empty($fielddata->types)) {
                foreach ($fielddata->types as $name => $type) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['type'] = $type;
                }
            }

            if (!empty($fielddata->rules)) {
                foreach ($fielddata->rules as $name => $rule) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['rule'] = $rule;
                }
            }

            if (!empty($fielddata->defaults)) {
                foreach ($fielddata->defaults as $name => $default) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['default'] = $default;
                }
            }

            if (!empty($fielddata->advanceds)) {
                foreach ($fielddata->advanceds as $name => $advanced) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['advanced'] = $advanced;
                }
            }
        }

        $this->existingoverrides = $purpose->get_purpose_overrides();
        $existingoverridecount = count($this->existingoverrides);

        $this->repeat_elements(
                $overrideelements,
                $existingoverridecount,
                $options,
                'overrides',
                'addoverride',
                1,
                get_string('addroleoverride', 'tool_dataprivacy')
            );
    }
177236
protected function getFormErrors(FormInterface $form)
    {
        $errors = [];
        foreach ($form->getErrors() as $error) {
            $errors[] = $error->getMessage();
        }
        foreach ($form->all() as $child) {
            if (!$child->isValid()) {
                $errors[$child->getName()] = $this->getFormErrors($child);
            }
        }

        return $errors;
    }
405426
public function getFormErrors ()
    {
        return array_map(function (FormValidator $formValidator) {
            return $formValidator->getErrorMsg();
        }, array_filter($this->validators, function (FormValidator $validator) {
            return !$validator->isValid();
        }));
    }
821811
private static function _findFormFields($data)
    {
        $ret = array();
        foreach ($data->getChildComponents(array('page'=>false, 'pseudoPage'=>false)) as $c) {
            if (Kwc_Abstract::getFlag($c->componentClass, 'formField')) {
                $ret[] = $c;
            }
            $ret = array_merge($ret, self::_findFormFields($c));
        }
        return $ret;
    }