Link_List
extends Links
in package
Provides text-only list of anchor links.
Tags
Table of Contents
Constants
- CONTAINER_CLASSES = array()
- Additional container classes.
- CONTAINER_DEFAULTS = array('aria_label' => 'links', 'class' => '', 'classes' => array('pnet-links-list'))
- Default container settings.
- EXTERNAL_RELS = array('external', 'noopener')
- External link rel attributes.
- ITEM_DEFAULTS = array('class' => '', 'classes' => array(), 'new_tab' => false, 'rel' => '', 'rels' => array(), 'service' => '', 'icon' => '', 'target' => '', 'text' => '', 'title' => '', 'url' => '')
- Default list item settings.
- LINK_CLASSES = array()
- Additional list item link classes.
- LIST_CONTAINER = 'link-list.php'
- The links container partial filename.
- LIST_ITEM_CONTAINER = 'link-item.php'
- The link list item partial filename.
Properties
- $container_atts : array<string|int, mixed>
- The attributes of the list container.
- $icons : Icons
- The instance of the SVG icon handler.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $item_atts : array<string|int, mixed>
- The array of list item definition arrays.
- $list_container : string
- The fully qualified path to the list container partial.
- $list_item_container : string
- The fully qualified path to the list item container partial.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- render() : void
- Render the list of links.
- __construct() : void
- Initialise the class and set its properties.
- get_rel_atts() : array<string|int, string>
- Return the link rel attributes.
- render_items() : void
- Render the link list item.
- set_container_attributes() : void
- Set the link container attributes.
- set_item_attributes() : void
- Set the link item attributes.
Constants
CONTAINER_CLASSES
Additional container classes.
protected
array<string|int, string>
CONTAINER_CLASSES
= array()
Override this in sub-classes to add additional classes to the links container.
Tags
CONTAINER_DEFAULTS
Default container settings.
protected
array<string|int, mixed>
CONTAINER_DEFAULTS
= array('aria_label' => 'links', 'class' => '', 'classes' => array('pnet-links-list'))
CONTAINER_DEFAULTS { Container arguments. @type string $aria_label The text for the nav element ARIA label. @type string $class The class tag markup. This is built in the set_item_attributes method. @type string[] $classes Class(es) to apply to container. }
Tags
EXTERNAL_RELS
External link rel attributes.
protected
array<string|int, string>
EXTERNAL_RELS
= array('external', 'noopener')
Tags
ITEM_DEFAULTS
Default list item settings.
protected
array<string|int, mixed>
ITEM_DEFAULTS
= array('class' => '', 'classes' => array(), 'new_tab' => false, 'rel' => '', 'rels' => array(), 'service' => '', 'icon' => '', 'target' => '', 'text' => '', 'title' => '', 'url' => '')
ITEM_DEFAULTS { List item arguments. @type string $class The class tag markup. This is built in the set_item_attributes method. @type string[] $classes Class(es) to apply to link. @type bool $new_tab New browser window flag. @type string $rel The rel tag markup. This is built in the set_item_attributes method. @type string[] $rels The array of link rel attributes. @type string $service The type of external service. @type string $icon The icon SVG markup. @type string $target The target tag markup. This is built in the set_item_attributes method. @type string $text The link text. @type string $title The link title attribute. @type string $url The link URL. }
Tags
LINK_CLASSES
Additional list item link classes.
protected
array<string|int, string>
LINK_CLASSES
= array()
Override this in sub-classes to add additional classes to each link items.
Tags
LIST_CONTAINER
The links container partial filename.
protected
string
LIST_CONTAINER
= 'link-list.php'
Tags
LIST_ITEM_CONTAINER
The link list item partial filename.
protected
string
LIST_ITEM_CONTAINER
= 'link-item.php'
Tags
Properties
$container_atts
The attributes of the list container.
protected
array<string|int, mixed>
$container_atts
= array()
Tags
$icons
The instance of the SVG icon handler.
protected
Icons
$icons
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$item_atts
The array of list item definition arrays.
protected
array<string|int, mixed>
$item_atts
= array()
Tags
$list_container
The fully qualified path to the list container partial.
protected
string
$list_container
= ''
Tags
$list_item_container
The fully qualified path to the list item container partial.
protected
string
$list_item_container
= ''
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
render()
Render the list of links.
public
render(array<string|int, mixed> $item_atts[, array<string|int, mixed> $container_atts = array() ]) : void
Parameters
- $item_atts : array<string|int, mixed>
-
An array of items and their attibutes.
- $container_atts : array<string|int, mixed> = array()
-
Optional. An array of container display attributes.
Tags
__construct()
Initialise the class and set its properties.
protected
__construct() : void
Tags
get_rel_atts()
Return the link rel attributes.
protected
get_rel_atts(array<string|int, mixed> $item_atts) : array<string|int, string>
Parameters
- $item_atts : array<string|int, mixed>
-
An array of items and their attibutes.
Tags
Return values
array<string|int, string> —The array of rel attribute values.
render_items()
Render the link list item.
protected
render_items() : void
(Maybe) override this in sub-classes.
Tags
set_container_attributes()
Set the link container attributes.
protected
set_container_attributes([array<string|int, mixed> $container_atts = array() ]) : void
Parameters
- $container_atts : array<string|int, mixed> = array()
-
Optional. An array of container display attributes.
Tags
set_item_attributes()
Set the link item attributes.
protected
set_item_attributes(array<string|int, mixed> $item_atts) : void
Parameters
- $item_atts : array<string|int, mixed>
-
An array of items and their attibutes.