🚀 Developing a Drupal 8 module with a controller and custom template

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 68

  • @mohanraj-gi9oy
    @mohanraj-gi9oy 6 років тому +3

    This is nice tutor and easy to understand how to use the custom module with route with theme.

  • @кремневесты-ю6ц
    @кремневесты-ю6ц 2 роки тому +3

    Thanks for great tutorial. Gould you continue Drupal lessons? Will be interesting make more difficult modules for Drupal with backend programming including backend - front developing modules and connection with frontend Drupal and backend in custom modules examples

  • @golubovicm
    @golubovicm 5 років тому +3

    Great tutorial. Really well explained and easy to follow. Thank you very much!

  • @Yainakiss
    @Yainakiss 5 років тому +2

    Thanks, Correction: You have to use article.name because that is the var on items

  • @TimKariuki
    @TimKariuki 6 років тому +4

    Thank you for this video. It was crucial to my understanding of outputting content.

  • @ivanvoveng914
    @ivanvoveng914 4 роки тому

    Fantastic tutorial

  • @costamachinerygmbh
    @costamachinerygmbh 6 років тому +1

    Hi there, brilliant video that helped me a lot get going.
    If you would extend this by some syntax hints how other pages could also be implemented within the same module that would help me (and perhaps many others?!?) another step further?

    • @Drupal-up
      @Drupal-up  6 років тому

      Hi,
      I am glad that you like the video and that it helped you! :)
      There are many videos that you could have a look at as a next step.
      E.G. how to create a simple form ua-cam.com/video/JjUYeKqB-gw/v-deo.html
      if you are interested in module development
      or
      Custom service ua-cam.com/video/Hnf3gEGzZ1o/v-deo.html
      for more Drupal module development
      or
      you could have a look at all the videos that we have and pick one:
      ua-cam.com/channels/n0rV2xX-qtbEbCFVSFveww.htmlvideos
      what do you mean with other pages in the same module? do you mean just multiple routes and controllers in the same module?
      Cheers and thanks a lot for the good words,
      Nikolay

  • @khaledadel7322
    @khaledadel7322 6 років тому +2

    Thank you very much, this helped a looot..
    but if i may ask one question please, how to add css and js to this custom page?
    i tried adding it through .libraries.yml and then attaching it through the the render array or attaching it to twig directly "attach_library()", but it doesnt work, i feel like i am missing something important,
    please help if you can.

    • @Drupal-up
      @Drupal-up  6 років тому

      you should be able to do it with attach library. Did you use the module name as a namespace when adding the library? so in the twig file it would be something like {{ attach_library('your_module/library_name') }}
      Here is the documentation for a reference: www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module

  • @shujatmunawar3316
    @shujatmunawar3316 4 роки тому +1

    Super awesome, to the point
    Thanks lot. i have one question please.
    How can i grab content from specific content type and then show it on html.twig page.
    rather than hardcoded array.
    Thanks again. :)

    • @shujatmunawar3316
      @shujatmunawar3316 4 роки тому

      For example: i have content type of News, Gallery and about us.
      Now i want a custom design page by which i can get all these information and show it on page as per my requirement.

  • @gulshanpal5348
    @gulshanpal5348 5 років тому +1

    good tutorial .easy to understand. Thank you.

    • @Drupal-up
      @Drupal-up  5 років тому +1

      I am glad you like it! Thanks for watching!

  • @mrx2586
    @mrx2586 5 років тому +1

    The way the list is displayed is the same as a block would be displayed in Druapl 7 if you navigated to its URL, ie it takes the content region of the page and other blocks populate other regions. Does this mean that what you have created here is considered to be a block?

    • @Drupal-up
      @Drupal-up  5 років тому

      Hi sam, well, yes and no. The general answer is no, because we are here just adding Title and Content, but if we want to be really precise with the answer the content element of the page is actually a block (Structure > Block layout > Content (region) > Main page content (block)). If you want to create a block that you want to place on the page you would have to create a Block Plugin here is a link to a video where I explain how to do that ua-cam.com/video/hMocvmLaPGQ/v-deo.html . Hope it answers your question, cheers and have a nice day!

  • @mehdinaimi9470
    @mehdinaimi9470 4 роки тому

    i like this video but if i want use front-page template ????

  • @codewithnacho
    @codewithnacho 6 років тому +1

    Awesome Tutorial! One question, How come Drupal is able to connect to the twig template? I'm just confused on how Drupal recognized it.

    • @Drupal-up
      @Drupal-up  6 років тому +1

      Thanks, I am glad you like it!
      It is basically being done in two steps:
      1. Declaration in the .module file, in the hook_theme() function. There you are declaring the theme and the twig template file have the same file name as your hook entry, but with dashes instead of underscores.
      2. Using it in your controller for the '#theme' value and passing the items that we are rendering in the twig template.
      Here is another easy example on drupal.org -> www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-for-custom-module
      Cheers and have a nice day!

  • @geoili
    @geoili 5 років тому

    Good stuff, but what if i want to render the result in a page i have already overriden lets say on page--front.html.twig ?
    How should i adjust the routing?? Also how can i adjust the twig call to the function and pass arguments to it?

  • @mangeshsathe
    @mangeshsathe 5 років тому

    Saved my day! Cheers

  • @eduardpinter676
    @eduardpinter676 4 роки тому

    I have a task of making some content of movies in admin panel in drupal, and then after that to use a custom module and controller to show those movies onto my custom twig. I am unable to find a solution or hint how to do that, maybe i even did find something but because of my small knowledge of drupal i dont know what i have to do in order to achieve that. I created a custom module, controller , routing and everything while following your video but after that i just frooze

  • @webdev7636
    @webdev7636 5 років тому +1

    Thanks

  • @KareemShobier
    @KareemShobier 5 років тому

    Thank you

  • @TheBz101
    @TheBz101 6 років тому +1

    Thank you :D

  • @takeyasunakazato9826
    @takeyasunakazato9826 4 роки тому

    amazing ...thank you.

  • @shem2382
    @shem2382 5 років тому

    Im using my own theme but I still can't get the twig template to be shown. How do you make multiple pages that allows one to use the twig templates

  • @sandipdas4765
    @sandipdas4765 3 роки тому

    how can i make sdk drupal plugin

  • @farhan_jiwani
    @farhan_jiwani 5 років тому

    I used your github code and made a page with the same site alias as the route but nothing shows up on the page after I activate the module. just my global theme. I'm not sure what I am missing... Yours is the 4th tutorial I've tried and I've had no luck so far. (I am a front-end dev and new to Drupal)

    • @farhan_jiwani
      @farhan_jiwani 5 років тому

      I also tried a basic page and a landing page

    • @farhan_jiwani
      @farhan_jiwani 5 років тому

      *facepalm* ok I deleted my Drupal page. I didn't realize the route didn't need an entry in the CMS.

  • @talhayaseen4898
    @talhayaseen4898 4 роки тому

    I have created .info.yml file inside sites/all/modules/new directory but there is no module generated naming 'new' in my Drupal
    So, what should I do to resolve this problem?
    Please help
    Note: I'm using Drupal 8

  • @chrisvetek
    @chrisvetek 2 роки тому

    looks like its not compatible with drupal 9. if i change the core: 8.x to core: 9.x in the yml file it won't display the extend page. if i leave it at 8.x it will show but grey out the checkbox. i'll research this for drupal 9.

  • @TheRajmoney
    @TheRajmoney 3 роки тому

    what does this do? what is the purpose of this module?

  • @ismailbarhdadi2564
    @ismailbarhdadi2564 6 років тому

    please help i create my module In the same way you but i display in form " Page not found
    The requested page could not be found." are you important to install drupal consol . i dont know how to install please help me

    • @Drupal-up
      @Drupal-up  6 років тому

      As you see in the video I am not using drupal console. The link to the end code of the module is in the description of the video, you could find it here, on github github.com/drupal-up/drupalup_controller You might simply get that module and change it as you need it.
      Cheers!

  • @DevLatBo
    @DevLatBo 6 років тому

    Hi Drupal Up i really try by the same way as you did exactly but its not showing me the text... is empty!! ... i can see the but the text inside the tag li is always empty... it doesnt print it!... please any help

    • @Drupal-up
      @Drupal-up  6 років тому

      Hi 05K4R1N UP, please send me your code and I will have a look what is wrong. It is surely something small. Also you may have a look here github.com/drupal-up/drupalup_controller the full code of the module. Cheers!

    • @DevLatBo
      @DevLatBo 6 років тому

      Drupal Up hii thanks for answer me... i dont find any email i can send my module to you... could you provide me? Mine is oskr.cbba2010@gmail.com pleade :(

    • @DevLatBo
      @DevLatBo 6 років тому

      HI Drupal Up! i dont have your email, if you please can give me your email, mine is oskr.cbba2010@gmail.com please! i need help

    • @Drupal-up
      @Drupal-up  6 років тому

      have you compared your code with the ready version of the module ? have you tried downloading the module that is the final version and installing it ? please just upload your code to github and send a link here in the comments so that the other people that read this could see what is the actuall problem if they have the same issues. Cheers!

    • @DevLatBo
      @DevLatBo 6 років тому

      yes, i copied exactly as the same you did even!!! sure that there is no error in your repo?

  • @jacobtyler9195
    @jacobtyler9195 5 років тому

    Great information about Developing a Drupal 8 module with a controller and custom template. For more information about PSD to drupal developer: www.psdconversion.net/psd-to-drupal-development.html

  •  5 років тому

    page not found mate

    • @Drupal-up
      @Drupal-up  5 років тому

      If you uninstall your module, back up and remove the example module's folder and then you directly put the ready version that you could find here github.com/drupal-up/drupalup_controller and then install it - is it still not working?
      Cheers!

    •  5 років тому +1

      @@Drupal-up it was my mistake bro, i didn't add the # in the name of the rendering variables in the controller, it's working :)

    • @Drupal-up
      @Drupal-up  5 років тому

      @ Perfect, cheers!

  • @stefanbubanj1134
    @stefanbubanj1134 5 років тому

    not working

  • @zojuhasz
    @zojuhasz 5 років тому +1

    Thank You :)

  • @timmilee1866
    @timmilee1866 5 років тому

    Thank You :)