There is no way to give a flexinode piece of content a title using the current CVS version of Drupal.

Comments

moggy’s picture

that goes for most contributed modules not just flexinode.

Blog, Page and other core nodetypes are showing the You must specify a title in red as soon as you try to use them.

It's got to be a bug, or an api change in the cvs that was introduced today.

moggy’s picture

Status: Active » Needs review

is an api change.

modules should now handle their own titles.

patch attached fixes this, but consider this. There have been times when I've not wanted a title on a flexinode. This now looks possible, so what would be the best way of making it optional?

moggy’s picture

StatusFileSize
new456 bytes

helps if I attach the patch :D

fago’s picture

i would prefer being able to define a field as title field, so that it's content will be stored in $node->title

Steve Dondley’s picture

I have hacked node.module in the past so that the "Title" field can be something other than "Title". Sometimes, it's just not appropriate. For example, you flexinode content type for entering data about people. In that case, you wouldn't want "Title", you'd want it to be "Name". Would be nice if the new version of Drupal allows for that.

fago’s picture

that's the cause of this issue. drupal 4.7 will do it

Steve Dondley’s picture

The above patch does nothing to let a flexinode use any label other than "Title" for the field. A new setting is needed for each flexinode content type that allows you to change the label for the field. It seems logical to put this setting on the admin/node/type/edit_type/# page. The setting, a simple textfield on the form, could be called "Label for 'Title' field" and default to the generic label "Title". The field should be required and not accept blanks.

Then the flexinode_form() function could be programmed to retrieve this label.

Steve Dondley’s picture

Slight change to the above: maybe the you could leave the label field blank if you did not want to have a title.

moggy’s picture

How about a new field type of "title"?

Steve Dondley’s picture

StatusFileSize
new2.46 KB

OK, here is a patch that allows you to change the label from 'Title' to something else, or nothing at all. Please give it a try. Remember, this is designed only to work with Drupal HEAD, not 4.6 or earlier versions.

Steve Dondley’s picture

Oops, forgot to mention you need to add a new varchar(255) field to the flexinode_type table in the database. The name of the field is "label".

Steve Dondley’s picture

StatusFileSize
new2.45 KB

Here's an improved version with help text that hopefully makes it more clear what the "Title label" setting does.

Bèr Kessels’s picture

Here is my MasterPlan: ;)

A simple textfield, that can be named anything, and is called "title". It should not show the 'show in table/teaser" checkboxes, and it should always be required.

That field is added to EVERY node type by default. All that can be done to it, is rename it. You cannot add, remove, weight etc it. It will sit on top of every node field.

1) having no titles at all will break drupal in a lot of places: Every node must have a title.
2) We dont want people tobe bothered by 'humhum, what is a title, I want to define fooBar content, I dont need titles in then'
3) A node can have any amount of, let's say files fields, but only one title.

And of course there must be some sort of upgrade script that makes all these 'fields' for already existing flexinode types. I'd say, they should be called 'title', by default.

Bèr

Steve Dondley’s picture

Sounds good to me. I'll create a new patch later today or tomorrow.

Steve Dondley’s picture

Ber,

I was doing some more thinking on this. Because the title field will be a special case compared to the other fields, the solution you propose above will entail some messy code. You'll need special code to handle the field so it's always on top, special code so that it can't be deleted, a database update script etc. I'm not sure adding this complexity is really worth the minor benefits gained compared to the patch I submitted above.

fago’s picture

an easy but not very clean solution might be to create a new checkbox for all textfields, which makes them to the title of this contenttype, if it's get checked.
perhaps save the id in the a new column `title_field_id` in flexinode_ctype. then just save the textfields value to $node->title, instead of inserting into flexinode_data...

Steve Dondley’s picture

StatusFileSize
new5.56 KB

OK, here's a patch along the lines of what Ber had suggested. Like I mentioned above, the code is not as clean as the previous patch created. But please have a look. Let me know which method you think works best and/or how they could possible be improved.

Steve Dondley’s picture

I forgot to mention (again) that a new int(1) field must be added to the flexinode_field table. It's name is 'is_title'. It identifies whether or not the field is a title and treats it accordingly.

Steve Dondley’s picture

StatusFileSize
new8.19 KB

This is a revised patch for the latest CVS version of flexinode. The first patch won't work.

Steve Dondley’s picture

Hmmm...something weird is going on where changes I didn't even make are getting into the patches. Disregard the above patch until I can get this straightened out.

Steve Dondley’s picture

OK, it looks like the original flexinode.mysql had some Windows style carriage returns in it. The above patch still works. It just replace some blank lines with new blank lines and a couple of lines with text with the same line of text (but different carriage return characters).

Bèr Kessels’s picture

Tha tis indeed a lot of code. But I am afraid you misunderstood my idea. In any case, Id like some comments on your idea, though. Maybe others like it;

Let me refrase what I had in mind:
in /node/types/add_type and the edit screens we show:
- the name of the nodetype (what we have now)
- a hardcoded form:
name of post title
[______________________________________]
give a name for the title. usually just 'title' or 'subject' should do.
- then the rest default form we have now.

Having the checkbox is a bit hackish and not too user friendly.

Steve Dondley’s picture

Ber, it seems to me what you just described is the first variant of my patch. See post #12. It just needs a simple modification to make the field a required field.

Bèr Kessels’s picture

Yes, indeed it is like #12, with a small difference, that it would be nice to be able to change the 'name of the title'. for example into 'subject' or 'oneliner' or so.
I would prefer that, or even #12 over the last patch, But I am fishing for other peoples commetns and thoughts on this.

If you think you have this done, nysus, please post a patch here, but otherwise, you can feel free to commit the patch at #12, nysus

Steve Dondley’s picture

I don't know if you missed it or if we just aren't communicating on the same wavelength but #12 does in fact let you change the label for the title field to whatever the user wishes. I will make it a required field and commit the patch a little later today.

Steve Dondley’s picture

Status: Needs review » Closed (fixed)

This thread has been closed because it is unduly long and messy. Please see http://drupal.org/node/32537 for a continuation of this discussion.