Skip to content

Commit e2d46c8

Browse files
authored
Update tenant selection in admin
1 parent 154ae01 commit e2d46c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/XeroSiteConfigExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ public function updateCMSFields(FieldList $fields)
3030
$fields->addFieldsToTab('Root.Xero', [
3131
ReadonlyField::create('XeroAccessToken', 'Access token')
3232
->setDescription(sprintf(
33-
'<a href="%s">Link to a xero account</a>',
33+
'<a href="%s" target="_blank">Link to a new xero account</a>',
3434
XeroFactory::singleton()->getRedirectUri()
3535
))
3636
]);
3737

3838
if ($this->owner->XeroAccessToken) {
39-
$provider = XeroFactory::singleton()->getProvider();
4039
$tenants = [];
40+
$tenantRecords = XeroFactory::singleton()->getTenants($this->owner->XeroAccessToken);
4141

42-
foreach ($provider->getTenants($this->owner->XeroAccessToken) as $tenant) {
43-
$tenants[$tenant->id] = $tenant->name;
42+
foreach ($tenantRecords as $tenant) {
43+
$tenants[$tenant->id] = $tenant->tenantName;
4444
}
4545

4646
$fields->addFieldsToTab('Root.Xero', [
4747
DropdownField::create(
4848
'XeroTenantId',
49-
'XeroTenantId',
49+
'Xero Tenant',
5050
$tenants
5151
)
5252
]);

0 commit comments

Comments
 (0)