<?php

// phpcs:disable
use Ayyash\AdminOptions\Ayyash_Admin_Options;
// phpcs:enable

$docs = Ayyash_Admin_Options::ayyash_docs_data();

echo '<ul>';
foreach ( $docs as $doc ) {
	printf(
		'<li><a target="_blank" href="https://www.wpayyash.com/docs/ayyash/%s/" rel="noopener">%s</a>%s',
		esc_attr( $doc['slug'] ),
		esc_attr( $doc['name'] ),
		isset( $doc['items'] ) ? '<ul>' : '</li>'
	);
	if ( isset( $doc['items'] ) ) {
		foreach ( $doc['items'] as $doc_child ) {
			printf(
				'<li><a target="_blank" href="https://www.wpayyash.com/docs/ayyash/%s/%s/" rel="noopener">%s</a></li>',
				esc_attr( $doc['slug'] ),
				esc_attr( $doc_child['slug'] ),
				esc_attr( $doc_child['name'] )
			);
		}
		echo '</ul></li>';
	}
}
echo '</ul>';
