You are here

protected function LibraryListForm::buildRow in Skinr 8.2

Build a table row for the skin info listing page.

Parameters

array $skin_info: The list of existing skin info.

$extra:

$theme:

Return value

array The form row for the given module.

1 call to LibraryListForm::buildRow()
LibraryListForm::buildForm in skinr_ui/src/Form/LibraryListForm.php
Form constructor.

File

skinr_ui/src/Form/LibraryListForm.php, line 137
Contains \Drupal\skinr_ui\Form\LibraryListForm.

Class

LibraryListForm
Provides skinr plugin installation interface.

Namespace

Drupal\skinr_ui\Form

Code

protected function buildRow($skin_info, $theme) {

  // Grab source info.
  $info = system_get_info($skin_info['source']['type'], $skin_info['source']['name']);
  $source = !empty($info['name']) ? $info['name'] : $skin_info['source']['name'];

  // Set the basic properties.
  $row['name']['#markup'] = $skin_info['title'];
  $row['description']['#markup'] = $skin_info['description'];
  $row['source']['#markup'] = $this
    ->t('%source !type', array(
    '%source' => $source,
    '!type' => $skin_info['source']['type'] == 'module' ? t('module') : t('theme'),
  ));
  $row['version']['#markup'] = $skin_info['source']['version'];
  $theme_hooks = array();
  foreach ($skin_info['theme hooks'] as $theme_hook) {
    $theme_hooks[] = $theme_hook == '*' ? $this
      ->t('all hooks') : $theme_hook;
  }
  $row['#theme_hooks'] = $theme_hooks;

  // Present a checkbox for enabling and indicating the status of a module.
  $status = !empty($skin_info['status'][$theme]) ? $skin_info['status'][$theme] : 0;
  $row['enable'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable'),
    '#default_value' => (bool) $status,
    '#disabled' => (bool) $status,
  );
  return $row;
}