<?php
/**
 * Plugin action links.
 *
 * @package StoreSheet
 */

declare( strict_types=1 );

namespace StoreSheet\Settings;

defined( 'ABSPATH' ) || exit;

class PluginLinks {

	public function init(): void {
		add_filter( 'plugin_action_links_' . STORESHEET_BASENAME, array( $this, 'add_links' ) );
	}

	/**
	 * @param string[] $links
	 * @return string[]
	 */
	public function add_links( array $links ): array {
		$settings_link = sprintf(
			'<a href="%s">%s</a>',
			esc_url( admin_url( 'admin.php?page=storesheet' ) ),
			esc_html__( 'Settings', 'storesheet' )
		);

		array_unshift( $links, $settings_link );
		return $links;
	}
}
