<?php

/**
 * Admin class - Contains all the admin related functionality.
 *
 * @package FormEnhancer
 */

namespace FormEnhancer;

use FormEnhancer\Interfaces\ComponentInterface;

/**
 * Admin class.
 */
class Admin implements ComponentInterface
{
	/**
	 * Setup.
	 *
	 * @return void
	 */
	public function setup(): void
	{
		\add_filter('plugin_action_links_' . \FORMENHANCER_BASENAME, [$this, 'plugin_action_links'], 10, 1);
	}

	/**
	 * Add action links.
	 *
	 * @param array $links Plugin action links.
	 *
	 * @return array
	 * @throws Exception
	 */
	public function plugin_action_links(array $links): array
	{
		$custom_links = [
			'<a href="' . \admin_url('options-general.php?page=formenhancer') . '">' . \esc_html__('Settings', 'formenhancer') . '</a>',
			'<a href="' . \esc_url('https://formenhancer.com/docs/') . '" target="_blank">' . \esc_html__('Help', 'formenhancer') . '</a>',
		];
		return \array_merge($custom_links, $links);
	}
}
