You are here

function theme_synonyms_behaviors_settings in Synonyms 7

Default theme implementation for behavior settings form element.

1 theme call to theme_synonyms_behaviors_settings()
synonyms_settings_form in ./synonyms.pages.inc
Synonyms settings form for a specific entity type and bundle name.

File

./synonyms.pages.inc, line 391
Menu page callbacks of Synonyms module.

Code

function theme_synonyms_behaviors_settings($variables) {
  drupal_add_css(drupal_get_path('module', 'synonyms') . '/synonyms.css');
  $element =& $variables['element'];
  $table = array(
    'header' => array(
      t('Field'),
    ),
    'rows' => array(),
    'empty' => t('Seems like there are no fields for which synonyms functionality available. Try adding a text field to get started.'),
  );
  $instance_ids = array();
  foreach (element_children($element) as $behavior) {
    $table['header'][] = check_plain($element[$behavior]['#title']);
    $instance_ids = array_unique(array_merge($instance_ids, element_children($element[$behavior])));
  }
  foreach ($instance_ids as $instance_id) {
    $row = array();
    $row_title = '';
    foreach (element_children($element) as $behavior) {
      if (isset($element[$behavior][$instance_id]['#title']) && !$row_title) {
        $row_title = check_plain($element[$behavior][$instance_id]['#title']);
      }
      $row[] = array(
        'data' => isset($element[$behavior][$instance_id]) ? drupal_render($element[$behavior][$instance_id]) : t('Not implemented'),
        'class' => array(
          'synonyms-behavior-settings',
          'synonyms-behavior-settings-' . $behavior,
        ),
      );
    }
    array_unshift($row, $row_title);
    $table['rows'][] = $row;
  }
  return '<div id="' . $element['#id'] . '">' . theme('table', $table) . drupal_render_children($element) . '</div>';
}