On admin/content, I have created different views for articles and basic pages (the default content types created from Drupal). On admin/content, it shows Content | Article | Basic Page. When I already have Article and Basic page as separate.
On admin/content, I would like to show as Blank means no data instead of showing all data.
I tried the following code.
modules/custom/mcontent/src/Routing/RouteSubscriber.php
modules/custom/content/src/Routing/RouteSubscriber.php
namespace Drupal\content\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
/**
* Listens to the dynamic route events.
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* Used to alter routes.
*/
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection->get('system.admin_content')) {
$route->setDefaults(array(
'_controller' => '\Drupal\content\Controller\ContentOverviewController::overview',
));
}
}
}
I'm trying to override its default controller, so it show blank.
The code for the controller is the following one.
namespace Drupal\mcontent\Controller;Drupal\content\Controller;
use Drupal\system\Controller\SystemController;
/**
* Class ContentOverviewController.
*/
class ContentOverviewController extends SystemController {
/**
* Content Overview.
*/
public function overview($link_id) {
$build = [
'#markup' => $this->t('Hello World!'),
];
return $build;
}
}
The code doesn't seem to work.
I also tried to disable the content view, but that is not needed.