Skip to content

Commit

Permalink
Render auth button within license field container
Browse files Browse the repository at this point in the history
  • Loading branch information
tarecord committed Sep 11, 2024
1 parent cc7da69 commit 33e957f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/Uplink/Admin/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,11 @@ public function get_render_html(): string {

$args = [
'field' => $this,
'resource' => $this->resource,
'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() );

$html = (string) ob_get_clean();
} else {
$html = $this->view->render( self::VIEW, $args );
}
$html = $this->view->render( self::VIEW, $args );

/**
* Filters the field HTML.
Expand Down
5 changes: 5 additions & 0 deletions src/views/admin/fields/field.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php declare( strict_types=1 );
/**
* @var Field $field The Field object.
* @var Resource $resource The Field resource.
* @var string $group The group name.
*/

use StellarWP\Uplink\Config;
use StellarWP\Uplink\Admin\Fields\Field;
use StellarWP\Uplink\Resources\Resource;
?>

<?php
Expand Down Expand Up @@ -60,6 +62,9 @@ class="regular-text stellarwp-uplink__settings-field"
</fieldset>
<?php echo $field->get_nonce_field(); ?>
</div>
<?php if ( $resource->is_using_oauth() ) : ?>
<?php \StellarWP\Uplink\render_authorize_button( $resource->slug, $resource->get_home_url(), $resource->license_key); ?>
<?php endif; ?>
</div>
<?php if ( $field->should_show_label() ) : ?>
</td>
Expand Down

0 comments on commit 33e957f

Please sign in to comment.