You are here

function taxonomy_tools_copier_nodes in Taxonomy Tools 8

Same name and namespace in other branches
  1. 7 taxonomy_tools_copier/taxonomy_tools_copier.admin.inc \taxonomy_tools_copier_nodes()

Builds taxonomy term associated node list.

Parameters

int $tid: Taxonomy term identificator.

1 call to taxonomy_tools_copier_nodes()
taxonomy_tools_copier_content in taxonomy_tools_copier/taxonomy_tools_copier.admin.inc
Builds taxonomy term hierarchical tree.

File

taxonomy_tools_copier/taxonomy_tools_copier.admin.inc, line 282
Administrative page callbacks for the Taxonomy Copier module.

Code

function taxonomy_tools_copier_nodes($tid) {
  $content = array();
  $content[$tid . '-nodes'] = array(
    '#type' => 'container',
    '#theme' => 'taxonomy_tools_copier_nodes_container',
    '#states' => array(
      'visible' => array(
        ':input.' . $tid . '-option' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#attributes' => array(
      'name' => $tid . '-nodes',
      'class' => array(
        $tid . '-nodes',
        'nodes',
      ),
    ),
  );
  $count = taxonomy_tools_copier_associated_nodes_count($tid);
  if ($count > 0) {

    // Options for all term associated nodes.
    $content[$tid . '-nodes'][$tid . '-nodes-option'] = array(
      '#type' => 'radios',
      '#title' => t('All nodes'),
      '#options' => array(
        'none' => t('Do nothing'),
        'copy' => t('Copy all'),
        'link' => t('Link all'),
        'custom' => t('Custom'),
      ),
      '#default_value' => variable_get('taxonomy_tools_copier_node_config', 'none'),
      '#title_display' => 'invisible',
    );
    $content[$tid . '-nodes'][$tid . '-nodes-list'] = array(
      '#type' => 'container',
      '#attributes' => array(
        'class' => array(
          $tid . '-nodes-list',
          'nodes-list',
        ),
        'name' => $tid . '-nodes-list',
      ),
      '#theme' => 'taxonomy_tools_copier_nodes_list_container',
    );

    // Link to reveal all nodes.
    $content[$tid . '-nodes'][$tid . '-nodes-list-link'] = array(
      '#type' => 'link',
      '#title' => t('Show nodes'),
      '#href' => '',
      '#ajax' => array(
        'path' => 'taxonomy-copier/' . $tid . '/nodes/show',
        'wrapper' => 'edit-' . $tid . '-nodes-list',
        'progress' => array(
          'type' => 'none',
        ),
      ),
      '#attributes' => array(
        'class' => array(
          $tid . '-nodes-list-link',
        ),
      ),
    );
  }
  return $content;
}