ICT:Drupal - creating new entities: content types
Appearance
Step 1: Creating and configuring the content type
Initial creation of the content type
- structure/content types
- create a new content type
- give it a name - example chapter (NO s in the end)
- fill n the description
- REPLACE the proposed Title field label from Title to Code
- Fill in the Explanation or submission guidelines
- SAVE
Step 2: Create the fields for this content type
- create a new field and chose the field type
- give it a label like "Description", "Name", etc..
- depending on the field type - fill in what is needed for that field
- IMPORTANT: edit the machine name to for example ch_description, pl_name
- continue button
- continue specifying the field. Limited should be 1 for a simple field
- provide a help text or the user to explain what to fill in
- SAVE
Special Field for recursiveness: Parent
- create a parent field using reference as field type
- use content for the field type
- continue
- Type of reference: Content
- provide help text
- specify the content type -being the same for a recursive entity
- fill in the sort mode: normally Code - with the sort direction
- SAVE
All field defined ?
Check the list of all fields for
- given names and tyoes
- SPECIAL check for the systems name: should be field_xx_fieldname
- xx = the first 2 characters of the content type
Form Display arrangement
Goto the tabFom Display
- disable all the unneeded system field: replace content by disabled
- for the parent field - replace autocomplete by "select list"
- check that you only have the fields you want
- SAVE
Step 2 creating and configuring the view =
creating the view
- structure/views
- create new view
- give it a name: the samename of the entity but this time WITH s at the end
- give it a description
- show Content of type "table name"
- select Create page and give it a title - example Chapters with s
- modify the path: add admin/ in front of the page name
- select Page display settings: Table of fields
- items to display - 10 is OK with use pager
- NO menu link of RSS feed nor a block creation - it will be a dashboard page
- Save and edit
Edit the view
- there should be an initial field with name Title.
- select this and replace the name/label Title by Code
- deselect link to the content
- style settings: check that the default class is enabled
- APPLY
- add supplementary fields from the entity/content type
- add a special field: "Link to edit Content" from category content
- no label for this field
- replace "edit" by a pencil and go to Table/Settings and select Right align for this field
- rearrange the list of fields and put the Link to edit Content as first column
- rearrange can be found under Add - select 0 for the link and APPLY
Adding a create new record link in the Header
- in Header selext Add
- select Text Area in Global
- select Display even if view has no result
- in content past this and adapt chapter (conten type name) and chepters (view name) and APPLY
<a href="/node/add/chapter?destination=/admin/chapters">Add a Chapter</a>
Sorting and Filtering
- goto the sorting section
- add Title (content) ascending and delete all the rest
- filter only on the table and delete all the rest.
STEP 3: Testing
- use /admin/viewname with for example viewbame = chapters then admin/chapters
- first time you should see the title of the view and only a link to create a first record
- create a first record
- check with the pencil if one can edit the record - not going to SOLO but staying in GIN
- make a sublevel record and check the parent field
- if other foreign keys are present, check