public function getLink($entity_type, $link_text = 'here', $bundle = NULL) {
    $url = FALSE;
    switch ($entity_type) {
      case 'node':
        $url = Url::fromUserInput('/admin/content');
        break;

      case 'node_type':
        $url = Url::fromRoute('entity.node_type.delete_form', ['node_type' => $bundle]);
        break;

      case 'block_content':
        $url = Url::fromRoute('entity.block_content.collection');
        break;

      case 'block_content_type':
        $url = Url::fromRoute('entity.block_content_type.delete_form', ['block_content_type' => $bundle]);
        break;

      case 'media':
        $url = Url::fromUserInput('/admin/content/media');
        break;

      case 'media_type':
        $url = Url::fromUserInput("/admin/structure/media/manage/$bundle/delete");
        break;

      case 'webform_submission':
        $url = Url::fromRoute('entity.webform_submission.collection');
        break;

      case 'webform':
        $url = Url::fromUserInput('/admin/structure/webform');
        break;

      case 'paragraphs_type':
        $url = Url::fromRoute('entity.paragraphs_type.delete_form', ['paragraphs_type' => $bundle]);
        break;
    }

    if (!$url) {
      return FALSE;
    }

    $link = Link::fromTextAndUrl($link_text, $url)->toRenderable();
    return render($link);
  }
public function getLink($entity_type, $link_text = 'here', $bundle = NULL) {
    $url = FALSE;
    switch ($entity_type) {
      case 'node':
        $url = Url::fromUserInput('/admin/content');
        break;

      case 'node_type':
        $url = Url::fromRoute('entity.node_type.delete_form', ['node_type' => $bundle]);
        break;

      case 'block_content':
        $url = Url::fromRoute('entity.block_content.collection');
        break;

      case 'block_content_type':
        $url = Url::fromRoute('entity.block_content_type.delete_form', ['block_content_type' => $bundle]);
        break;

      case 'media':
        $url = Url::fromUserInput('/admin/content/media');
        break;

      case 'media_type':
        $url = Url::fromUserInput("/admin/structure/media/manage/$bundle/delete");
        break;

      case 'webform_submission':
        $url = Url::fromRoute('entity.webform_submission.collection');
        break;

      case 'webform':
        $url = Url::fromUserInput('/admin/structure/webform');
        break;

      case 'paragraphs_type':
        $url = Url::fromRoute('entity.paragraphs_type.delete_form', ['paragraphs_type' => $bundle]);
        break;
    }

    if (!$url) {
      return FALSE;
    }

    $link = Link::fromTextAndUrl($link_text, $url)->toRenderable();
    return render($link);
  }
public function getLink ( $ entity_type , $ link_text = 'here' , $ bundle = NULL ) { $ url = FALSE ; switch ( $ entity_type ) { case 'node' : $ url = Url :: fromUserInput ( '/admin/content' ) ; break ; case 'node_type' : $ url = Url :: fromRoute ( 'entity.node_type.delete_form' , [ 'node_type' => $ bundle ] ) ; break ; case 'block_content' : $ url = Url :: fromRoute ( 'entity.block_content.collection' ) ; break ; case 'block_content_type' : $ url = Url :: fromRoute ( 'entity.block_content_type.delete_form' , [ 'block_content_type' => $ bundle ] ) ; break ; case 'media' : $ url = Url :: fromUserInput ( '/admin/content/media' ) ; break ; case 'media_type' : $ url = Url :: fromUserInput ( "/admin/structure/media/manage/$bundle/delete" ) ; break ; case 'webform_submission' : $ url = Url :: fromRoute ( 'entity.webform_submission.collection' ) ; break ; case 'webform' : $ url = Url :: fromUserInput ( '/admin/structure/webform' ) ; break ; case 'paragraphs_type' : $ url = Url :: fromRoute ( 'entity.paragraphs_type.delete_form' , [ 'paragraphs_type' => $ bundle ] ) ; break ; } if ( ! $ url ) { return FALSE ; } $ link = Link :: fromTextAndUrl ( $ link_text , $ url ) -> toRenderable ( ) ; return render ( $ link ) ; }
Helper function for ling generation.

@param string $entity_type
Config or content entity type.
@param string $link_text
Text that will be displayed inside link.
@param string $bundle
For config entity type need to set bundle (it used in delete link).

@return bool|string
Rendered html link or FALSE.
Helper function for ling generation .