Add a new content type

Introduction
Creating a custom content type allows you to create content in which the data are entered and saved in specific fields. If you already have data available, which are stored in a table or a database, you can create a custom content type with exactly the same fields and import the data into the Scratchpad.

Adding content type

 * 1) From the Admin menu go to Structure > Content types
 * AdminContentTypes.jpg
 * 1) Click + content type link at the top
 * 2) Enter a NAME ("Literature mining") and DESCRIPTION
 * AddContentType.jpg
 * 1) Under the Submission form settings tab change the TITLE FIELD LABEL to Taxonomic name as cited
 * 2) Under the Display settings tab choose the View display and select Display on species pages
 * 3) Choose on which tab of the species pages the new content type should be visible
 * 4) Select Own tab so that the new content type appears on a tab of its own
 * 5) Click the Save and add fields button. This will lead to the Manage fields tab

Managing fields
By default every new content type has a title and a body field. In this example the body field is not needed, so click on delete for this field.

Term reference fields
First we want to add a field that links to the biological classification, so that we can tag our new literature mining content to one or more taxonomic names. Like with other content types, the Taxonomic name field should be an autocomplete field. A field like this is already present in several content types, so we don't need to create a new one, we can use the existing one. Because it links to the taxonomy module a field like this is called a Term reference.


 * 1) Go to Add existing field. As Label enter "Taxonomic name"
 * 2) In the Field to share drop down menu select Term reference: field_taxonomic_name (Taxonomic name) and in the Form element to edit the data drop down menu select Autocomplete term widget (tagging)
 * 3) Click Save
 * 4) Select whether users should be required to fill this field, add help text and choose to how many taxonomic names (NUMBER OF VALUES) a node of this content type can be linked. Usually this will be unlimited. The field_taxonomic_name field by default links to any biological classification on the site and you can't change this.
 * EditField.jpg
 * Click Save

Node reference fields
Next we want to add a field that links to the biblio content type (References), so that we can select a biblio node. This field should be a dropdown menu. Again, a field like this is already present in other content types, so we can use the existing one. Because it links to a node in a different content type a field like this is called a Node reference
 * 1) Go to Add existing field. As Label enter "Reference", in the Field to share drop down menu select Node reference: field_reference (Reference) and in the Form element to edit the data drop down menu select Select list
 * 2) Click Save
 * 3) Make this field a Required field. The NUMBER OF VALUES should be "1" because each literature mining node should link to only one biblio node

Text fields
Next we want to add a field for the page number on which the taxon is cited in the reference. A page field doesn't exist, yet, so we need to create a new field. Since pages are numbers, we could use Integer as data type. However, in some cases we might want to add a range of pages and this would not be possible with "Integer", so instead it is better to use the "Text" data type, which is for text that is up to 255 characters long.
 * 1) Go to Add new field. As Label enter "Page", in the Type of data to store drop down menu select Text and in the Form element to edit the data drop down menu select Text field
 * 2) Click Save
 * 3) Under Field settings enter "20" as MAXIMUM LENGTH. This should give plenty of space for adding the page number.

List fields
There are various options for adding keywords to our new content type. We can just link to the existing keywords on the site that are for example used for images. To do this we would add the existing "Term reference: Field_keywords (Keywords) field. We could also create a new non-biological vocabulary for our literature mining keywords and create a new term reference field linking to this vocabulary. With the right settings, new keywords can be added to this vocabulary by adding them to the literature mining node. Another option would be to create a list of literature mining categories to choose from and then enter additional information or keywords into a text field. We will do the latter now:
 * 1) Go to Add new field. As Label enter "Literature mining category", in the Type of data to store drop down menu select List (text) and in the Form element to edit the data drop down menu select Select list
 * 2) Click Save
 * ManageFields2.jpg
 * 1) In the ALLOWED VALUES LIST enter a few categories, e.g. distribution, original name, type information, one line each
 * 2) Click Save and Save on the next page also

Long text fields
For adding extracts of the cited paper, we need a text field that can hold more information then just 255 characters. So we will use a 'Long text' field.
 * Go to 'Add new field'. As 'Label' enter "Text", in the 'Type of data to store' drop down menu select "Long text" and in the 'Form element to edit the data' drop down menu select "Text area". Save and save again.
 * As HELP TEXT enter "Enter keywords or text extracts from the mined paper" and under TEXT PROCESSING select "Filtered text", so that it is possible to use italics and other formatting. Save settings.

Groups
To facilitate the entering and viewing of fields, they can be sorted into groups. Groups can be shown as boxes around the fields (Fieldset) or for example as horizontal tabs in the view and edit mode. For the few fields we have in this content type groups are not really necessary, but we will add two anyway to demonstrate horizontal tabs. Each horizontal tab (horizontal tab item) is a group and all tabs together also form a group (horizontal tabs group). First we need to create a horizontal tab group to which we then add horizontal tab items.


 * 1) Go to Add new group. As Label enter "Horizontal tabs" and as Group name enter "horizontal_tabs"
 * 2) In the drop down menu select Horizontal tabs group
 * 3) Click Save
 * AddLiteratureMining.jpg
 * 1) Go to Add new group. As Label enter "Reference data" and as Group name enter "reference_data"
 * 2) In the drop down menu select ''Horizontal tab item"
 * 3) Click Save
 * 4) Drop and drag the Reference and the Page fields into the Reference data group
 * 5) Click Save
 * 6) Create another horizontal tab item called "Text mining" and move the Literature mining category and Text fields into it
 * 7) Click Save
 * 8) Drag the Reference data and the Text mining groups into the Horizontal tabs group
 * LiteratureMining1.jpg
 * 1) Click Save


 * Check out how your new content type looks by adding a literature mining node. If you do this in a separate browser tab you can play around with changing the settings and seeing how this affects the view.

Managing display
The way the node is displayed can be changed under the Manage display tab. Two things can be changed: The position and presence of the label and the format of the field. The field format largely depends on the field type
 * 1) Change all the labels to "Inline" to save space and have a look at the format options for different field types but don't change any
 * 2) Click Save
 * LiteratureMining2.jpg
 * LiteratureMining3.jpg


 * At the point where a new content type has been saved a menu item is added to the Main menu. By default this page just lists the titles of literature mining nodes with a link to the respective node. To improve this page and change it for example into a matrix, you need to edit the view.