Skip to content

Commit

Permalink
Remove function use statement for Strauss compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tarecord committed Sep 12, 2024
1 parent e20bf39 commit 81df548
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/views/admin/fields/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use StellarWP\Uplink\Config;
use StellarWP\Uplink\Admin\Fields\Field;
use StellarWP\Uplink\Resources\Resource;
use function StellarWP\Uplink\render_authorize_button;
use StellarWP\Uplink\Components\Admin\Authorize_Button_Controller;
?>

<?php
Expand Down Expand Up @@ -64,7 +64,19 @@ class="regular-text stellarwp-uplink__settings-field"
<?php echo $field->get_nonce_field(); ?>
</div>
<?php if ( $resource->is_using_oauth() ) : ?>
<?php render_authorize_button( $resource->slug, get_site_url(), $resource->license_key ?? '' ); ?>
<?php
try {
Config::get_container()->get( Authorize_Button_Controller::class )->render( [
'slug' => $field->get_slug(),
'domain' => get_site_url(),
'license' => $resource->license_key,
] );
} catch ( Throwable $e ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( "Unable to render authorize button: {$e->getMessage()} {$e->getFile()}:{$e->getLine()} {$e->getTraceAsString()}" );
}
}
?>
<?php endif; ?>
</div>
<?php if ( $field->should_show_label() ) : ?>
Expand Down

0 comments on commit 81df548

Please sign in to comment.