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

How to set Front Page

Hello Friends,

I am trying to set the Front Page of my Drupal website via a custom module I created. I think it should be noted that I also have a theme applied to my website.

I have looked around and it appears the solution has something to do with page--front.html.twig. I have located this file inside themeFolder/templates but I dont know what to do with it.

I tried literally creating this file inside myModule/templates/page--front.html.twig, with no success.

Programmatically authentication problem

Hi 2 all!

Don't know, right topic I choose or not, but here we are.

I have a problem with user auth via ajax. Here is a code:

function logInUser($uid) {
        global $user;
        $user = user_load($uid);        
        
        $login_array = array('name' => $user->name);
        user_login_finalize($login_array);
    }

Send to array uid. When ajax called there is no errors, in watchdog I see "session for user USER is opened" and user setted to USER. But there is no auth.

How to upload multiple images at once - form input

Hello friends,

I am trying to upload multiple images at once, using form input, but I have no idea how to achieve this?

my input looks as follows: 

    $form['listing_slides']['dbl_slides'] = array(
     '#type' => 'managed_file',
     '#title' => 'Slides',
     '#description' => 'Slides that visible on the listings page',
     '#upload_location' => 'public://upload/business_listing/slides',
     '#required' => TRUE,
    );

At the moment this only lets me select a single image for upload.

How to add .html.twig file to a region programatically?

Hello friends,

I am trying to add a template I have defined in my custom module to a region on my theme programatically.

I see there are regions defined in my theme .info.yml file, but I havent the slightest idea of how I would go about adding content to these specific regions programatically? I know I can create a custom block and place it in a region via the UI, but I am trying to add content to these regions via code.

Any advice would be greatly appreciated <3

How to add .html.twig template based on my websites installed theme.

Hello friends,

I have installed a theme to my Drupal 8 website, now I would like to create .html.twig templates in a custom module that is based off this theme.

inside the theme folder, there is a templates folder with two files: page--front.html.twig page.html.twig, page.html.twig looks as follows: 

Drop down menu keeps refreshin my page.

Hello and sorry for my bad English. I am using Drupal 8 and i want to make a menu with categories. The menu title has to be CATEGORIES and when someone click on it, the menu has to show the categories with a drop down. So i've created categories. Then i created a menu called - CATEGORIES and i marked "show as expanded". In the menu link i added - route:<nolink> . So now i have Categories menu with drop down listing categories, but when i click on it, the page is refreshed. I dont whant the page to be refreshed everytime i clikc on CATEGORIES.

Pages

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