+4 votes
183 views
Drupal - Custom types types

in CMS by (552k points)
reopened | 183 views

1 Answer

+5 votes
Best answer

One of the features that makes Drupal one of the most popular content management systems, is its inherent ability at its core to define totally customized content types .
  • We click on Structure in the administration bar and then click on the Content Types section.

image

  • In the Content type screen, we click on the Add content type link.
  • In Name we enter Recipe as the name of our custom content type.
  • In order for our content type to have a base schema in HTML5 based on a recipe, we enter the following address in the description: http://schema.org/Recipe
  • For the field of Title field label , enter name . The reason why we change the default text of the Title field field from Title to name is that we are going to model our Recipe-type content type microdata based on HTML5. This will provide a semantic definition of our content to increase the results in any search engine.

image

  • We click on Save .
  • Then we eliminate the Body field that is automatically added to our content type. We click on the delete link and then confirm on the next screen.

image

  • Now we will add some new fields to our content type Recipe, the first property to add is the description. We click on Add new field input , we type description, in prefix_label we type description again and in the widget we select Text area and then Save . On the next screen we confirm and press Save field settings .

image

  • On the RECIPE SETTINGS page we enter a brief description of the item, accept the rest of the default settings and click on Save settings .
  • Now we will go to the properties of the image, we will use an existing field for this property. In the Add existing field section , enter image as the label. And in the field Field to share we select the option Images: field_image (image).

image

  • We click on the Save field settings button on the FIELD SETTINGS page.
  • On the next page, we click on the accept the default settings button for RECIPE SETTINGS and IMAGE FIELD SETTINGS .
  • The properties of datePublished and author will be captured by the property nodes of the Drupal kernel.
  • For the cookTime property the settings will be: label: cookTime, name: field_cooktime, type: Integer, widget: Text field.
  • We click on Save and accept the general settings on the next page.
  • On the next page we enter the time in minutes in the field The time it takes to actually cook the dish in minutes.
  • The properties of cookingMethod , nutrition , recipeCategory , recipeCuisine and totalTime will be added later.
  • For the ingredients property we add the necessary fields and save.
  • For the property of prepTime we add the necessary fields and save.
  • For the property of recipeInstructions we add the necessary fields and save.
  • With all of our added properties we should have our Recipe-type content that looks like this:


image



Just as we create a content type of Recipe type we can create another of any type without any inconvenience, that adapts to our page and the needs of it.

by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Jun 24, 2019 in CMS by backtothefuture (552k points) | 216 views
+4 votes
1 answer
asked Jun 24, 2019 in CMS by backtothefuture (552k points) | 269 views
+3 votes
1 answer
asked Jun 23, 2019 in CMS by backtothefuture (552k points) | 192 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users