How to create custom drupal 8 module - drupal

I am sure this question will irritate many old Drupal developers, but I just need a quick fix.
I want to
create a brand new custom module by a hook to an existing contributed module.
introduce a feature in my new module which is an alteration of a feature (e.g form) in the parent module.
Can someone please walk me through the coding ?
Say for example , I want to create my custom module from the simpleads module (https://www.drupal.org/project/simpleads), and my module needs to alter some forms in the src/forms folder.
Thanks

Related

Is there the equivalent of the WP plugin Types for Drupal 7?

So I have a Drupal 7 client who needs to have a dynamic content type...
name, description, 3 images
We will show these "objects" (for lack of a better word) in a filterable grid. Also, the client needs to be able to add, update and delete these on their own.
I have done this sort of thing many times in WordPress with the plugin called "Types" (https://wordpress.org/plugins/types/).
Is there an equivalent plugin for Drupal 7? If not, any thoughts as to how I would go about this?
Thanks,
David
One of the great advantages of using Drupal is that it is a framework for creating custom content types very easily using the administrative interface. See this for further reference and good luck!
http://m.linuxjournal.com/content/creating-and-theming-custom-content-type-drupal-7

Drupal 7 Login code files?

Hi i'm just new to Drupal and trying to modify the drupal login for some customizations. So far the Drupal structure is complicated for me yet, I'm just needing to know:
What are the main files for Login procedure?
Is it possible to customize the login like that, without going with new module creating way?
It depends on what you mean by customization. If you want to change the look and feel of the page, you can do so with some custom theming. http://drupal.org/documentation/theme
If you want to do common things like allowing people to log in using OpenID then there's usually an existing 3rd party module for that which you could find by Googling what you need.
But if you want to do something more customized than that then you're probably going to need to create a custom module, and use hook_form_alter() and the Form API to add/customize fields, add custom validation or submit handlers, stuff like that.

How can I create a theme preview module in Drupal 6?

I'm trying to create a simple module to preview themes in Drupal. Each user has their own custom node and I want to be able to show them a preview of how the theme will work without them actually enabling it. Right now this is what I have:
function theme_preview_info($new_theme, $node_id)
{
global $custom_theme;
$custom_theme = $new_theme;
$node = node_load($node_id);
return $node->body;
}
It will display the content of the node, but the formatting is all messed up. How can I properly display the node exactly as it would as if i went to node/1, but instead view it at theme_preview/theme_name/1?
Do you have any experience building Drupal modules?
If not, you may find that what you are trying to do is not all that simple.
You will need some interface for the user to choose which theme they are previewing. Then, you will need to hook into Drupal's routing to direct users to the appropriate node using the selected theme preview based on a customized path alias (theme_preview/theme_name/1). There's most likely a lot of other back-end overhead that I'm not anticipating at the moment.
If you have experience with building Drupal modules, though, that might not be a big deal.
Switching out the theme is probably the easiest part. If you're in Drupal 7, you can use an implementation of hook_custom_theme() to change the theme used for particular nodes based on your intended criteria (i.e., which theme the user selected).
http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_custom_theme/7
This way, you can actually allow Drupal and the selected theme to completely handle the rendering of the page, giving a more accurate preview.
I'm not sure how exactly you would go about creating the user's theme-switching interface or routing the user to a specific path alias for each theme selection.
You also might want to look into the ThemeKey module (http://drupal.org/project/themekey). It's possible you could use that module somehow to simply set up ab version of each node to be viewed in each different theme.

Drupal 7 custom themes

I really need help.
I have decided to build a website with drupal so that i can add drupal to my skills, but i am starting to think i have made a big mistake.
I am a wordpress developer and have built most off my websites with wordpress. The probalm i am have is custom templates with wordpress i can just create a custom temaplate by add some shortcode to the head off my theme file easy.
How do you do this with drupal is it completely modular can you adjust themes i am struggling trying to find a way off doing this. i started with drupal 6 and this was possible by doing the following.
page-node-17.tpl.php
i could just then assign this to the specific page with a node of 17, i have since switch to drupal 7 and this doesnt work.
Can someone please tell me if this is possible.
Thanks
Yes this is still completely possible, however, the naming convention changed. Now you will need to name it: page--node--17.tpl.php. For more information on naming templates, see Drupal 7 Template Suggestions. Also, the Theming Guide is a very useful resource.

theming inside a module

Hi Everyone I am new to drupal and i am working on drupal theming i have created my own modules which have textfields and javascript validation in it. Now i am trying to create own theme for my module but i am not getting how to do can anyone pls give me a idea of how to do from basic or any links which explains in detail from scratch. thanks in advance.
You don't create themes for modules, themes are made for an entire site which will have several modules enabled.
If you want your module to be themable, that is, make it easy to alter the markup it generates, you will have to use the drupal theme system.
For the most part, when your module needs to generate some markup, you need to use the theme() function.
Sometimes you will need to create some custom markup which there is no theme function for. If that is the case, you will need to register your theme functions, so Drupal know they are there and so themes can overwrite them if needed. This is done with hook_theme().
There is a guide for developers on how to use the theme system.
Hook_theme() is used to define your modules theme implementations.
This looks like quite a good overview.

Resources