You are here

function _tft_li in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x tft.module \_tft_li()

Format an <li> tag for the file explorer.

Parameters

string $name: The folder name.

int $tid: The taxonomy term tid.

string $li_class: CSS classes for the <li>.

string $span_class: CSS classes for the child <span>.

Return value

array The render array <li> tag

1 call to _tft_li()
_tft_output_children in ./tft.module
Return the sub-tree as an unordered list.

File

./tft.module, line 358
Contains tft.module.

Code

function _tft_li($name, $tid, $li_class, $span_class) {
  return [
    '#wrapper_attributes' => [
      'id' => 'tid-' . $tid,
      'class' => 'folder' . $li_class,
    ],
    [
      '#type' => 'html_tag',
      '#tag' => 'span',
      '#attributes' => [
        'class' => 'icon' . $span_class,
      ],
    ],
    [
      '#type' => 'html_tag',
      '#tag' => 'span',
      '#attributes' => [
        'class' => 'link-wrapper',
      ],
      [
        '#type' => 'link',
        '#attributes' => [
          'class' => 'folder-link',
        ],
        '#title' => $name,
        '#url' => Url::fromUri('internal:#term/' . $tid),
      ],
    ],
  ];
}