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
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?
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
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.
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
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. :)
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.
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?
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!
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!
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?
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
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)
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
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.
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
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!
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
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!
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 :(
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!
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
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 :)
This is nice tutor and easy to understand how to use the custom module with route with theme.
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
Great tutorial. Really well explained and easy to follow. Thank you very much!
Thanks, Correction: You have to use article.name because that is the var on items
Thank you for this video. It was crucial to my understanding of outputting content.
Fantastic tutorial
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?
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
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.
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
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. :)
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.
good tutorial .easy to understand. Thank you.
I am glad you like it! Thanks for watching!
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?
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!
i like this video but if i want use front-page template ????
Awesome Tutorial! One question, How come Drupal is able to connect to the twig template? I'm just confused on how Drupal recognized it.
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!
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?
Saved my day! Cheers
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
Thanks
Thank you
Thank you :D
amazing ...thank you.
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
how can i make sdk drupal plugin
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)
I also tried a basic page and a landing page
*facepalm* ok I deleted my Drupal page. I didn't realize the route didn't need an entry in the CMS.
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
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.
what does this do? what is the purpose of this module?
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
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!
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
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!
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 :(
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
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!
yes, i copied exactly as the same you did even!!! sure that there is no error in your repo?
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
page not found mate
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!
@@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 :)
@ Perfect, cheers!
not working
Thank You :)
Thank You :)