Skip to content

Commit

Permalink
refactor(Admin/Fields/Field) render license key field when required b…
Browse files Browse the repository at this point in the history
…y OAuth
  • Loading branch information
lucatume committed Sep 3, 2024
1 parent 9531f8c commit 8fc4cca
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Uplink/Admin/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,23 @@ public function render( array $args = [] ): void {
public function get_render_html(): string {
$this->asset_manager->enqueue_assets();

$args = [
'field' => $this,
'group' => $this->group->get_name( $this->get_slug() ),
];

if ( $this->resource->is_using_oauth() ) {
ob_start();

if ( $this->resource->oauth_requires_license_key() ) {
echo $this->view->render( self::VIEW, $args );
}

UplinkNamespace\render_authorize_button( $this->get_slug() );

return (string) ob_get_clean();
}

$args = [
'field' => $this,
'group' => $this->group->get_name( $this->get_slug() ),
];

$html = $this->view->render( self::VIEW, $args );

/**
Expand Down

0 comments on commit 8fc4cca

Please sign in to comment.