This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Changing core's routes with event subscriber. Error: Call to a member function setPath() on null.

I am trying to change core's routes with an event subscriber, but I am getting an error.

My code follows:

drupalup_route_alter.info.yml:

```

name: Drupal Up route subscriber
description: altering routes in our drupal instance
type: module
core_version_requirement: ^9

```

DrupalupRouteSubscriber.php:

```

<?php

namespace Drupal\drupalup_route_alter\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

Unable to render iframe from .module in D9

I have a custom module that originated in a D7 build, then migrated to D8, and now currently migrating to D9. Everything renders besides the iframe. When I look at the elements tab in the developer tools of chrome the div wrapper appears but there is no reference to an iframe. I get no errors in the console or in drupal reports. Does drupal not allow iframes to render from custom modules? the iframe code lives in the .module file, I've also tried rending it from the html.twig file and also tried rending a basic iframe from W3schools just to make sure my src was working.

Overriding a Contributed Module Function with No Hook

Hi, 

I feel like I've done a lot of searching around and there's a lot of answers out there using hook_menu_alter, themes, overriding a service, but this is none of the above. The function that I'm trying to tweak is the execute function in views_bulk_edit contributed module in:

/src/Form/BulkEditFormTrait.php 

field select

in a content type I have a select field linked to an entity reference
Through a callBack I update the select with the filtered values of the entity reference
The #option property is filled in like this

Error, I can't spot it.

I am having an error, but I can't figure out why it occurs.

This is my event subscriber:

<?php

namespace Drupal\module_hero\EventSubscriber;

use Symfony\Component\EventSubscriber\EventSubscriberInterface;

use Symfony\Component\HttpKernel\KernelEvents;

/**
 * Our events subscriber.
 */
class HeroInitSubscriber implements EventSubscriberInterface {

    public function __construct() {}

    public function onRequest($event) {    

    var_dump("Hello from our event"); die();
    } 

Export/Import Fields, Content Types, Views, Blocks, Menus, and Roles

I've developed a Drupal 9 site in our "development" environment. I'd like to copy it to a "testing", "staging", and eventually a "production" environment. How do I do this without exporting/importing the entire database? I have many views, custom fields, content types, blocks, menus, and roles to export/import.

I use to be able to do this in Drupal 6/7. There were easy to use UIs to export/import views, blocks, and content types but not menus. Where are they now?

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions