You are here

function theme_tipsy_custom_selectors_form in Tipsy 8

Same name and namespace in other branches
  1. 7 tipsy.admin.inc \theme_tipsy_custom_selectors_form()

Theme the table form for tipsy rules.

1 string reference to 'theme_tipsy_custom_selectors_form'
tipsy_theme in ./tipsy.module
Implements hook_theme().

File

./tipsy.module, line 29
Main file for Tipsy module.

Code

function theme_tipsy_custom_selectors_form($variables) {
  $form = $variables['form'];
  $rows = array();
  $headers = array(
    t('Selectors'),
    t('Options'),
  );
  foreach (Element::children($form) as $key) {
    $row = array(
      'data' => array(
        array(
          'data' => render($form[$key]['selector']),
        ),
        array(
          'data' => render($form[$key]['options']),
        ),
      ),
    );
    $rows[] = $row;
  }
  $output = [];
  $output[] = [
    '#theme' => 'table',
    '#header' => $headers,
    '#rows' => $rows,
    '#cache' => [
      'max-age' => 0,
    ],
  ];
  return render($output);
}