public function configure($id)
    {
        $instance = $this->_getOrThrow($id, ['locked' => false]);
        $arrayContext = [
            'schema' => [],
            'defaults' => [],
            'errors' => [],
        ];

        if ($this->request->data()) {
            $instance->accessible('*', true);
            $instance->accessible(['id', 'eav_attribute', 'handler', 'ordering'], false);

            foreach ($this->request->data as $k => $v) {
                if (str_starts_with($k, '_')) {
                    $instance->set(str_replace_once('_', '', $k), $v);
                    unset($this->request->data[$k]);
                }
            }

            $validator = $this->FieldInstances->validator('settings');
            $instance->validateSettings($this->request->data(), $validator);
            $errors = $validator->errors($this->request->data(), false);

            if (empty($errors)) {
                $instance->set('settings', $this->request->data());
                $save = $this->FieldInstances->save($instance);

                if ($save) {
                    $this->Flash->success(__d('field', 'Field information was saved.'));
                    $this->redirect($this->referer());
                } else {
                    $this->Flash->danger(__d('field', 'Your information could not be saved.'));
                }
            } else {
                $this->Flash->danger(__d('field', 'Field settings could not be saved.'));
                foreach ($errors as $field => $message) {
                    $arrayContext['errors'][$field] = $message;
                }
            }
        } else {
            $arrayContext['defaults'] = (array)$instance->settings;
            $this->request->data = $arrayContext['defaults'];
        }

        $this->title(__d('field', 'Configure Field'));
        $this->set(compact('arrayContext', 'instance'));
    }