You are here

function theme_commerce_backoffice_product_node_add_list in Commerce Backoffice 7

Override node_add_list theme.

Based on the url, filters the list of node types to only include product node types, or non-product display types.

1 string reference to 'theme_commerce_backoffice_product_node_add_list'
commerce_backoffice_product_theme_registry_alter in ./commerce_backoffice_product.module
Implements hook_theme_registry_alter().

File

./commerce_backoffice_product.module, line 212

Code

function theme_commerce_backoffice_product_node_add_list($variables) {
  $item = menu_get_item();
  $product_display_types = commerce_product_reference_node_types();
  $product_display_types = array_keys($product_display_types);
  $content =& $variables['content'];
  foreach ($content as $key => $value) {
    $node_type = unserialize($value['page_arguments']);
    $node_type = $node_type[0];
    $show_product = $item['path'] == 'node/add/add-product';
    if (!in_array($node_type, $product_display_types) && $show_product) {
      unset($content[$key]);
    }
    elseif (in_array($node_type, $product_display_types) && !$show_product) {
      unset($content[$key]);
    }
  }
  return theme_node_add_list($variables);
}