You are here

public function FlexiformBuilder::getCtoolsSubstitutionsList in Flexiform 7

Build a list of possible ctools substitutions.

Parameters

array $keywords: Optionally provide additional keywords to show.

Return value

array A render array of substitutions.

File

includes/flexiform.builder.inc, line 211
Specify builder classes for flexiforms.

Class

FlexiformBuilder
Base class for flexiform builders.

Code

public function getCtoolsSubstitutionsList($keywords = array()) {
  $content = array(
    '#theme' => 'table',
    '#header' => array(
      t('Keyword'),
      t('Value'),
    ),
    '#rows' => array(),
  );
  foreach ($this
    ->getCtoolsContexts() as $context) {
    foreach (ctools_context_get_converters('%' . check_plain($context->keyword) . ':', $context) as $keyword => $title) {
      $content['#rows'][] = array(
        check_plain($keyword),
        t('@identifier: @title', array(
          '@title' => $title,
          '@identifier' => $context->identifier,
        )),
      );
    }
  }
  if (count($content['#rows'])) {
    return $content;
  }
  else {
    return array();
  }
}