Hello.

I know there are plenty of "where to start" pages and other info, but I am hoping someone knowledgeable would be so kind to help me out with this. I am good with PHP and OOP but need some help with proper Drupal way of doing things (v8.1.1)

Could someone provide me with a rough list of API calls and concepts I would have to learn in order to make a module which does this:

1-Users register through custom registration form with a few extra fields.
2-Users can publish a page, by filling in/selecting/checking some fields in a page publishing screen. Ok, lets say there is only one field.
3-Users can list these pages and filter them by criteria which is based on fields used in item 2 mentioned above.

I am aware that to an experienced Drupal developer this doesn't sound very "basic" at all, but I am thinking more of a module which does just the things I listed and nothing else, hence the usage of word basic. A sort of more complex hello world. For example, lets say all I want is users being able to create a page with only one input field being dropdown list with options A, B and C, which makes a page which displays a letter, either A, B or C. And all users are able to list all those pages and filter them by selecting A, B or C.

What I am hoping here, is for someone to spare me a few hours of research, as I think I don't need to learn absolutely all Drupal 8 concepts in order to make a module which does just this.

Also I think if someone would make a tutorial which describes how to achieve this semi-simple module, more people would become interested in Drupal, as this is the basis for many types of websites.

Thanks for reading this, and thank you very much if you decide to help me out.

Comments

yelvington’s picture

The answer is "you wouldn't," because nothing you described requires a custom module.

Are you just trying to learn how to develop Drupal modules? Perhaps you should start here or with a book.

raspadsistema’s picture

Thank you very much for answer. I didn't know it is possible to achieve this without coding.
I am aware of Drupal module developer documentation, though it is big and many of examples are not 100% up to date with latest D8 version. I did go through the Hello World module but as for the rest of the documentation I feel like I am given all ingredients but no recipes.
What I am actually looking for is a little bit of guidance, if it is possible to achieve the functionality I mentioned without custom module, please point me to parts of documentation I should be looking into. I would be happy if someone can just mention a few terms I should read up on.
Once again:
-User is able to create a page ("content type" I guess?) and define it's content by selecting between options A, B or C.
-All the page does is print the selected option, so it shows either A, B or C.
-All users are able to list all of those pages, and if they wish filter them by selecting A, B or C.

I am just a sort of person who likes to dive in first, and read the book later. Now that you mentioned that it is possible to achieve this functionality without coding, I feel more lost than before, so it would be great if you can give me some more waypoints please, and I promise I'll read the book later.

VM’s picture

you can use a custom content type for 2
you can use a view for 3

not sure why you need 1 - not enough detail.

raspadsistema’s picture

Alright, thank you both for answers. I'm starting to see what Drupal is. On one hand, there is ability to make a custom web app through admin interface using modules which became part of the core, mainly Views, while module writing is for true OOP programmers who care about standards, design patterns, packaging rules etc. Though for a newcommer it looks like a CMS with identity crisis at first. I approached it as a coder and didn't care to read much about what can be done with admin backend stuff, but now that I learned more I realize Views is brilliant, especially since I don't like to code through several files of app's skeleton to achieve "simple" filtered listing.

The questions below are optional if anyone feels like answering, in the mean time I'll probably run into all the answers anyway while reading documentation and checking out module sources.

Do people who write complex modules use Views? As in, do they let content types and listing be created by clicking through admin, while using module only for some overrides? If the module is to be packaged and used in other websites, I suppose they create content types and listings programmatically?

If I want more control over how a listing view is displayed, and lets say replace some filters with some javascript framework inputs, can all this be done through templating, away from module system? Or one would need to write module with some overrides at least?

The reason I asked about custom fields for new user registration - lets say I would like a filtered listing of a custom content type to also have filters which reference custom fields of a user who created that content. So, not only is there a filter for A, B and C option of the content type but also for 1, 2 or 3 option of user profile. I suppose the easiest way to do this would be to give those same extra fields of a user to a content type, and copy them from user profile into content during content creation time. Is this where module writing steps in, or is it still possible to achieve this with clicking through admin interface?
Update: of course, one problem with above solution would be that if a user changes a detail in his profile, there would have to be function which updates that same field in all the content he created. If I want to avoid that by storing a reference to the user in a content, I guess this where actual module writing has to be done, I don't expect admin interface to be so powerful.