# photonic/3.37/Components/Grid_Anchor.php

Photonic Gallery &amp; Lightbox for Flickr, SmugMug &amp; Others, version 3.37. 62 lines.

- Page: https://pluginprobe.com/plugins/photonic/3.37/code/Components/Grid_Anchor.php
- Raw: https://pluginprobe.com/plugins/photonic/3.37/raw/Components/Grid_Anchor.php
- Modified: 2026-07-23T21:21:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/photonic/3.37/code/Components/Grid_Anchor.php#L10-L20`.

```php
<?php

namespace Photonic_Plugin\Components;

use Photonic_Plugin\Core\Photonic;
use Photonic_Plugin\Layouts\Core_Layout;
use Photonic_Plugin\Platforms\Base;

require_once 'Grid_Figure.php';

class Grid_Anchor implements Printable {
	public string $href = '';
	public string $id = '';
	public array $classes = [];
	public array $rel = [];
	public string $title = '';
	public array $data = [];
	public string $figcaption = '';

	public string $indent = '';

	/**
	 * @var Grid_Image $image
	 */
	public $image;

	public function html(Base $module, Core_Layout $layout, bool $print = false): string {  // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
		$data_pieces = array_map(
			function (string $key, string $value): string {
				return $key . '="' . $value . '"';
			},
			array_keys($this->data),
			array_values($this->data)
		);
		$data_attributes = implode(' ', $data_pieces); // includes target='_blank', if needed

		$classes = esc_attr(implode(' ', $this->classes));

		$rel = '';
		if (!empty($this->rel)) {
			$rel = "rel='" . esc_attr(implode(' ', $this->rel)) . "'";
		}

		$id = '';
		if (!empty($this->id)) {
			$id = "id='" . esc_attr($this->id) . "'";
		}

		$ret = "{$this->indent}\t\t<a href='{$this->href}' title='{$this->title}' $rel class='$classes' $id $data_attributes>\n";
		$ret .= $this->indent . "\t\t\t" . $this->image->html($module, $layout) . "\n";
		if (!empty($this->figcaption)) {
			$ret .= $this->indent . "\t\t\t" . $this->figcaption . "\n";
		}
		$ret .= "{$this->indent}\t\t</a>\n";

		if ($print) {
			echo wp_kses($ret, Photonic::$safe_tags);
		}
		return wp_kses($ret, Photonic::$safe_tags);
	}
}

```
