public function renderEditControl(array $handles) { $provides_type = $this->getFieldConfigValue('credential.provides'); $credential_type = $this->getFieldConfigValue('credential.type'); $all_types = PassphraseCredentialType::getAllProvidesTypes(); if (!in_array($provides_type, $all_types)) { $provides_type = PassphraseCredentialTypePassword::PROVIDES_TYPE; } $credentials = id(new PassphraseCredentialQuery())->setViewer($this->getViewer())->withIsDestroyed(false)->withProvidesTypes(array($provides_type))->execute(); return id(new PassphraseCredentialControl())->setLabel($this->getFieldName())->setName($this->getFieldKey())->setCaption($this->getCaption())->setAllowNull(!$this->getRequired())->setCredentialType($credential_type)->setValue($this->getFieldValue())->setError($this->getFieldError())->setOptions($credentials); }