This project is designed to help people who are learning to write code that uses the Drupal 7 Field API programatically. This package contains two example modules which add simple fields to the user object. These are designed to be entry-level tutorials. The code is thoroughly documented and the mechanism used is explained.

This project includes simpler examples than the Field Example in the Examples Project and provides a more thorough description of the various API calls. This project also discusses some popular modules outside the Drupal core, which is not part of the charter of the Examples Project.

Install in the usual place, then enable the Fieldexamples module and read its Help. Then enable either or both of the Human Name and Three Questions modules as desired. Both modules have detailed Help.

Drupal core version 7.x

Project: http://drupal.org/sandbox/WaltHaas/1466474

git clone --branch 7.x-1.0-rc1 WaltHaas@git.drupal.org:sandbox/WaltHaas/1466474.git

Comments

lukas.fischer’s picture

I very like your approach to make a module with additional examples. However, as you mentioned, the Example Project is exactly for that. Personally I think you should contact the guys of the Examples Project and add your code there. Also I think it would make sense to write help pages on drupal.org showing this code + help texts. I don't know what others think?

I checked the code and for me all looks clean. Just some general feedback:

- Your examples are soley related to additional user fields. You might rename the module title.
- As you said, your module is more a "tutorial". Why don't you mention it Tutorial_UserField or something like this (just an idea...)
- In the first place, I did not see that there are 2 submodules. It would be very helpful to outline (e.g. in the readme) what the difference are of the 2 submodules.
- You may name the submodules in the Help overview page Fieldexamples Human Name. I did not find the help pages for the submodules in the first place. I looked for Fieldexamples.
- I like the heavy linking in the help pages!
- Personally when I read a tutorial, I love the see a screenshot of the result. You may add a screenshot somewhere (in the help, project page) which shows the final result when you have done the tutorial.

Notes:
- I havent checked the *.test files

Hope this helped.

patrickd’s picture

Status: Needs review » Closed (duplicate)

I have to agree with lukas.fischer, you should really join forces with the maintainers of the examples project so we got all good examples in one place. I had a look at it several times and IMHO they really need help to make thinks better (especially field and entity examples).
It would be awesome if you help them directly without creating a 'duplicating' module.

Feel free to reopen when you disagree with that,
thanks

walt haas’s picture

Thank you for all the kind words. The reason I did not submit this as an addition to the Examples project originally is that the rules for that project seem too rigid, in two areas: 1) Core modules only and 2) No good way to add additional examples in a subject area. However it seems that there is now a discussion of how to reorganize the Examples project to which I added a comment.

-- Walt

walt haas’s picture

It seems that Randy's idea for the Examples Project is more along the lines of splitting up examples for different core modules into different projects. There has also been some discussion of moving the examples project into core in D8. Personally my own philosophy is to keep the core compact and as simple as possible, because that's the part of the system that must be stable and reliable, so I don't like that idea.

I think there would be a lot of benefit for the community if there were an umbrella project that showed how the various contributed modules can be used together. At the moment I'm trying to learn how to use Rules with Entity API. There are several "core" contributed modules like that which are extremely valuable but not easy to learn individually, and even harder to learn in combination. So in my proposed idea, there would be an example that shows basic use of Entity API, one that shows basic use of Rules, then a third that shows how they can work together. Yes this is ambitious :-) but I think very useful if it could be done.

In response to #1, I chose user as my starting point because it's in core, everybody uses it and it has no bundles therefore is the simplest and commonest possible entity. My thought was to provide further examples using bundles later. Maybe it's just me, but I learn best when I can start with something that is simple and works, such as a simple example, then experiment with that and see what effect different changes have. So for me it seems natural to combine tutorial with example in a "learn by doing" package. I like the screenshot idea, I'll try to add some. Maybe using the Advanced Help module would give more ways to show how the various examples are related. I tried that but took it out because it seemed like overkill for my simple examples. Maybe that was a wrong decision.

Re #2, Randy thought my comment was outside the scope of that issue. In order to move toward a unified Examples project, I would need to open an issue to make the organization and scope of the project much larger and more flexible, which would create added work for the maintainers. I don't mind helping with this but I think it would be hard to convince Randy.

avpaderno’s picture

Title: Fieldexamples » [D7] Fieldexamples
Issue summary: View changes
Status: Closed (duplicate) » Closed (won't fix)