original_string: public function addPage() {
      $content = array();
  
      foreach (\Drupal::entityTypeManager()->getStorage('site_commerce_type')->loadMultiple() as $type) {
        $content[$type->id()] = $type;
      }
  
      if (!count($content)) {
        return $this->redirect('entity.site_commerce_type.add_form');
      }
  
      if (count($content) == 1) {
        $type = array_shift($content);
        return $this->redirect('entity.site_commerce.add_form', array('site_commerce_type' => $type->id()));
      }
  
      return array(
        '#theme' => 'site_commerce_add_list',
        '#content' => $content,
      );
    }
code: public function addPage() {
      $content = array();
  
      foreach (\Drupal::entityTypeManager()->getStorage('site_commerce_type')->loadMultiple() as $type) {
        $content[$type->id()] = $type;
      }
  
      if (!count($content)) {
        return $this->redirect('entity.site_commerce_type.add_form');
      }
  
      if (count($content) == 1) {
        $type = array_shift($content);
        return $this->redirect('entity.site_commerce.add_form', array('site_commerce_type' => $type->id()));
      }
  
      return array(
        '#theme' => 'site_commerce_add_list',
        '#content' => $content,
      );
    }
code_tokens: public function addPage ( ) { $ content = array ( ) ; foreach ( \ Drupal :: entityTypeManager ( ) -> getStorage ( 'site_commerce_type' ) -> loadMultiple ( ) as $ type ) { $ content [ $ type -> id ( ) ] = $ type ; } if ( ! count ( $ content ) ) { return $ this -> redirect ( 'entity.site_commerce_type.add_form' ) ; } if ( count ( $ content ) == 1 ) { $ type = array_shift ( $ content ) ; return $ this -> redirect ( 'entity.site_commerce.add_form' , array ( 'site_commerce_type' => $ type -> id ( ) ) ) ; } return array ( '#theme' => 'site_commerce_add_list' , '#content' => $ content , ) ; }
docstring: Displays add content links for available content types.
  
  Redirects to site_commerce/add/[type] if only one content type is available.
  
  @return array|\Symfony\Component\HttpFoundation\RedirectResponse
  A render array for a list of the site_commerce types that can be added; however,
  if there is only one site_commerce type defined for the site, the function
  will return a RedirectResponse to the site_commerce add page for that one site_commerce
  type.
docstring_tokens: Displays add content links for available content types .