You are here

function commerce_backoffice_product_node_overview_types in Commerce Backoffice 7

Override of node_overview_types().

See also

node_overview_types()

1 string reference to 'commerce_backoffice_product_node_overview_types'
commerce_backoffice_product_menu_alter in ./commerce_backoffice_product.module
Implements hook_menu_alter().

File

./commerce_backoffice_product.module, line 402

Code

function commerce_backoffice_product_node_overview_types() {
  module_load_include('inc', 'node', 'content_types');
  $types = node_type_get_types();
  $product_node_types = commerce_product_reference_node_types();
  $names = node_type_get_names();
  $field_ui = module_exists('field_ui');
  $header = array(
    t('Name'),
    t('Product display'),
    array(
      'data' => t('Operations'),
      'colspan' => $field_ui ? '4' : '2',
    ),
  );
  $rows = array();
  foreach ($names as $key => $name) {
    $type = $types[$key];
    if (node_hook($type->type, 'form')) {
      $type_url_str = str_replace('_', '-', $type->type);
      $row = array(
        theme('node_admin_overview', array(
          'name' => $name,
          'type' => $type,
        )),
      );

      // Set the product display column.
      $row[] = isset($product_node_types[$key]) ? t('Yes') : t('No');

      // Set the edit column.
      $row[] = array(
        'data' => l(t('edit'), 'admin/structure/types/manage/' . $type_url_str),
      );
      if ($field_ui) {

        // Manage fields.
        $row[] = array(
          'data' => l(t('manage fields'), 'admin/structure/types/manage/' . $type_url_str . '/fields'),
        );

        // Display fields.
        $row[] = array(
          'data' => l(t('manage display'), 'admin/structure/types/manage/' . $type_url_str . '/display'),
        );
      }

      // Set the delete column.
      if ($type->custom) {
        $row[] = array(
          'data' => l(t('delete'), 'admin/structure/types/manage/' . $type_url_str . '/delete'),
        );
      }
      else {
        $row[] = array(
          'data' => '',
        );
      }
      $rows[] = $row;
    }
  }
  $args = array(
    '!variation_type' => l(t('product variation type'), 'admin/commerce/config/product-variation-types'),
  );
  $build['help'] = array(
    '#markup' => '<p>' . t('Each piece of content on the site (blog post, page, product) is of a specific type.') . ' <br />' . t('Different types have different fields, used for storing additional information, or categorizing the content.') . '</p>' . '<p>' . t('Each product display type has a matching !variation_type, since each product display must have one or more product variations.', $args) . '<br />' . t('Start by creating a new !variation_type, which will then create the matching product display type.', $args) . '</p>',
  );
  $build['node_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No content types available. <a href="@link">Add content type</a>.', array(
      '@link' => url('admin/structure/types/add'),
    )),
  );
  return $build;
}