SlideShare a Scribd company logo
Introduction to Drupal 7

                                 Session 2.2
                           Content types and fields



Drupalist: Kalin Chernev          Course by Init Lab (http://initlab.org)   1
Agenda
•    What is a content type
•    Content type settings
•    Fields
•    Popular contributed modules




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   2
What is a content type
• Simply: the most powerful Drupal feature
• By default: 2 content types:
       – Basic page
       – Article
• Unlimited number of custom content types
• Many types of fields, no limitations on the
  number of them


Drupalist: Kalin Chernev    Course by Init Lab (http://initlab.org)   3
Content type settings
•    Name and description fields
•    Submission form settings
•    Publishing options
•    Display settings for meta data
•    Comments settings
•    Menu settings
•    Other – when additional modules are enabled

Drupalist: Kalin Chernev        Course by Init Lab (http://initlab.org)   4
Creating new content type
• Administration > Structure > Content types
• URL: ../admin/structure/types




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   5
Adding news content type example




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   6
Fields management
• Administration > Structure > Content types
• {The content type} > manage fields




Drupalist: Kalin Chernev       Course by Init Lab (http://initlab.org)   7
Manage Fields vs Manage Displays
• Manage fields
       – Adding new fields
       – Removing fields
       – Grouping fields (with additional module)
•    Order of the fields
•    Setting labels display
•    Setting fields contents display
•    Again, grouping fields in groups (with additional
     module)

Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   8
Adding a date field to news
• Download/Install Date module
• Enable “Date”, “Date API” and “Date Popup”
• Go to
  admin/structure/types/manage/news/fields
• Add a new field:
       – Label: Original publish date
       – Field type: Date
       – Machine readable: “orig_pub_date”
       – Widget type: Pop-up calendar
Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   9
The date field
• Field settings:
       – Date attributes to collect: leave it as it is, the
         granularity is good to be by minutes
       – Collect an end date: leave it as it is, we don’t need
         to collect end date value
       – Time zone handling: set to “No time zone
         conversion”
       – Cache dates: leave it as it is, we don’t need
         caching for now

Drupalist: Kalin Chernev    Course by Init Lab (http://initlab.org)   10
Advanced date field settings
• Required field: yes, we want to make sure the user has
  filled in a value here
• Date entry options: set it as you prefer the format to
  be
• Starting year: -0 years from now: we don’t really need
  more time back
• Ending year: +0 years from now: we don’t need more
  time ahead as well
• Default date: set it to “Now” as we want the field to
  take current time by default
• Number of values: set it to “1”, as we need only 1
  value
Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   11
Adding the date field




Drupalist: Kalin Chernev        Course by Init Lab (http://initlab.org)   12
System date settings

 Reports will notify you for required date settings. Some recommended options:




Drupalist: Kalin Chernev        Course by Init Lab (http://initlab.org)          13
Adding an image field




Drupalist: Kalin Chernev        Course by Init Lab (http://initlab.org)   14
Image field settings
• Allowed file extensions: the extensions the user can upload in the field:
  jpg, png, etc
• File directory: used rarely, only if you want the field to store images in
  specific folder which is not the sites/default/files folder
• Maximum and minimum image resolutions: used rarely, only if you want
  to limit the input dimensions of the images
• Maximum upload size: this is the limitation you can set on the physical
  size of the files
• Enabling Alt and Title: good to have if the administrator/editor has some
  SEO knowledge to populate these meta data
• Preview image style: options come from Image style module. The size you
  specify here is only for the back-end work of the admin
• Number of values: from 1 to unlimited, depending on the case
• Default image: rarely used, only if a feature or section requires an image,
  you can set one default to be displayed when the admin does not upload
  one

Drupalist: Kalin Chernev       Course by Init Lab (http://initlab.org)      15
Adding tags field
• You can use the default existing Tags vocabulary field
• Use the ”Autocomplete term widget (tagging)” widget type
• Save and create with default settings




Drupalist: Kalin Chernev      Course by Init Lab (http://initlab.org)   16
Adding tags field
• You can either use and existing Category vocabulary field or
  create one (if the first one is not available) (1st screenshot)
• Use the ”Select list” widget type as you want the Category
  field to be a list of values, only 1 of which can be selected
• Set the number of values to be 1, in the Category field settings
  (second screenshot)




Drupalist: Kalin Chernev      Course by Init Lab (http://initlab.org)   17
Compiling news content type feature
• We can export our News content type
  configurations into code for better versioning
• Make sure you have the Features module
  enabled and go to Administer > Structure >
  Features > Create new
• Name and description of the feature are arbitrary
  – anyway aim to specify them logically enough
  you can remind yourself what the feature is
  about
• You can start with 7.x-1.0 for the version
Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   18
News content type feature
• Select “News” content type from the node
  bundle components options
• Select all fields related to the news content
  type from the Fields component: all that start
  with “node-news-…”
• Download the feature
• Place the feature in your modules directory
  and enable it

Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   19
News content type feature




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   20
Enabling the News content type
• Administration > Structure > Features




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   21
Popular contributed modules
• Date – for date type fields
• Field Group – grouping multiple fields in a fieldset
  with various options of output
• Link – having options for attributes
• Email – including validations
• Field permissions – for settings permissions on a
  field-by field level
• Media – different media handling
• References – referencing nodes and users

Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   22
Time for questions




Drupalist: Kalin Chernev       Course by Init Lab (http://initlab.org)   23
Contacts
Kalin Chernev
       – E: kalata@shtrak.eu
       – T: twitter.com/kalinchernev
       – U: http://shtrak.eu/kalata




Drupalist: Kalin Chernev   Course by Init Lab (http://initlab.org)   24

More Related Content

PPTX
CI/CD trên Cloud OpenStack tại Viettel Networks | Hà Minh Công, Phạm Tường Chiến
PDF
Helm – The package manager for Kubernetes
PDF
A crash course in CRUSH
PPTX
OpenStack HA
KEY
Selenium Grid
PPTX
Kubernetes #6 advanced scheduling
PPTX
Helm @ Orchestructure
PDF
Alphorm.com Java 8: les nouveautés
CI/CD trên Cloud OpenStack tại Viettel Networks | Hà Minh Công, Phạm Tường Chiến
Helm – The package manager for Kubernetes
A crash course in CRUSH
OpenStack HA
Selenium Grid
Kubernetes #6 advanced scheduling
Helm @ Orchestructure
Alphorm.com Java 8: les nouveautés

What's hot (20)

PDF
Introduction to Datasource V2 API
PDF
Kubernetes
PDF
Ceph Block Devices: A Deep Dive
PDF
Securing Prometheus exporters using HashiCorp Vault
DOCX
Sai krishna
PPTX
Distributed Caching in Kubernetes with Hazelcast
PDF
Cassandra at eBay - Cassandra Summit 2012
PDF
Virtualization with KVM (Kernel-based Virtual Machine)
PPTX
Kubernetes Basics
PDF
Understanding DLmalloc
PPTX
Test de logiciels
PDF
Kubernetes: Reducing Infrastructure Cost & Complexity
PPTX
Proxmox Clustering with CEPH
PPTX
Cassandra Day NY 2014: Apache Cassandra & Python for the The New York Times ⨍...
PDF
Tuning Apache/MySQL/PHP para desenvolvedores
PDF
Configuration management II - Terraform
PPTX
An Introduction to Maven
PDF
What's Coming in CloudStack 4.19
PPTX
Hadoop World 2011: Hadoop Troubleshooting 101 - Kate Ting - Cloudera
Introduction to Datasource V2 API
Kubernetes
Ceph Block Devices: A Deep Dive
Securing Prometheus exporters using HashiCorp Vault
Sai krishna
Distributed Caching in Kubernetes with Hazelcast
Cassandra at eBay - Cassandra Summit 2012
Virtualization with KVM (Kernel-based Virtual Machine)
Kubernetes Basics
Understanding DLmalloc
Test de logiciels
Kubernetes: Reducing Infrastructure Cost & Complexity
Proxmox Clustering with CEPH
Cassandra Day NY 2014: Apache Cassandra & Python for the The New York Times ⨍...
Tuning Apache/MySQL/PHP para desenvolvedores
Configuration management II - Terraform
An Introduction to Maven
What's Coming in CloudStack 4.19
Hadoop World 2011: Hadoop Troubleshooting 101 - Kate Ting - Cloudera
Ad

Similar to Introduction to Drupal 7 - Content types and fields (20)

PDF
Introduction to Drupal 7 News section and home page block with views
PDF
Introduction to Drupal 7 - Updating core, themes and modules. applying patches
PDF
Introduction to Drupal 7 - Basic Functionalities and Content management
PDF
Introduction to Drupal 7 - Blocks management and contexts
PDF
Introduction to Drupal 7 - Panels
PDF
Introduction to Drupal 7 - Taxonomy Categorization - Homework included
PPTX
Introduction to Drupal 7 - Webforms
PDF
Introduction to Drupal 7 Users and roles management
PDF
Introduction to Drupal 7 - Getting Drupal up and running
PDF
Introduction to Drupal 7 - Making a slideshow with Views 3
PDF
Introduction to Drupal 7 Themes and design
PDF
Introduction to Drupal 7 - Performance optimization
PDF
Blisstering drupal module development ppt v1.2
PPTX
Oleksandr Medvediev - Content delivery tools in Drupal 8.
PPTX
Drupal module development
PPTX
Top 8 Improvements in Drupal 8
PPTX
Cypress report
PDF
Drupal: Reusing functionality
PDF
Introduction to Drupal 7 - SEO
PPTX
Forms 6i guide
Introduction to Drupal 7 News section and home page block with views
Introduction to Drupal 7 - Updating core, themes and modules. applying patches
Introduction to Drupal 7 - Basic Functionalities and Content management
Introduction to Drupal 7 - Blocks management and contexts
Introduction to Drupal 7 - Panels
Introduction to Drupal 7 - Taxonomy Categorization - Homework included
Introduction to Drupal 7 - Webforms
Introduction to Drupal 7 Users and roles management
Introduction to Drupal 7 - Getting Drupal up and running
Introduction to Drupal 7 - Making a slideshow with Views 3
Introduction to Drupal 7 Themes and design
Introduction to Drupal 7 - Performance optimization
Blisstering drupal module development ppt v1.2
Oleksandr Medvediev - Content delivery tools in Drupal 8.
Drupal module development
Top 8 Improvements in Drupal 8
Cypress report
Drupal: Reusing functionality
Introduction to Drupal 7 - SEO
Forms 6i guide
Ad

More from Kalin Chernev (17)

PDF
Style guides in drupal development workflows
PDF
RESTful with Drupal - in-s and out-s
PDF
Trainings and education at hackerspaces
PDF
Introduction to Frontend Development - Session 2 - CSS Fundamentals
PDF
Introduction to Frontend Development - Session 1 - HTML Fundamentals
PDF
SEO Fundamentals Outline Lecture 2
PDF
Search Engine Optimization Fundamentals
PDF
Hackerspaces in Bulgaria Lecture VarnaConf 2012
PPTX
Introduction to Drupal 7 - Homework - webforms on webforms
PDF
Introduction to Drupal 7 - Installing and configuring WYSIWYG editors in Drupal
PDF
Introduction to Drupal 7 - Homework on making latest news slideshow block
PDF
Introduction to Drupal 7 - Homework - making team section
PDF
Introduction to Drupal 7 - Image Styles
PPTX
Business education
PDF
Drupal course-plovdiv-week1-day-1
PDF
Drupal-курс-лекция-6
PDF
Курс по Drupal - лекция 3
Style guides in drupal development workflows
RESTful with Drupal - in-s and out-s
Trainings and education at hackerspaces
Introduction to Frontend Development - Session 2 - CSS Fundamentals
Introduction to Frontend Development - Session 1 - HTML Fundamentals
SEO Fundamentals Outline Lecture 2
Search Engine Optimization Fundamentals
Hackerspaces in Bulgaria Lecture VarnaConf 2012
Introduction to Drupal 7 - Homework - webforms on webforms
Introduction to Drupal 7 - Installing and configuring WYSIWYG editors in Drupal
Introduction to Drupal 7 - Homework on making latest news slideshow block
Introduction to Drupal 7 - Homework - making team section
Introduction to Drupal 7 - Image Styles
Business education
Drupal course-plovdiv-week1-day-1
Drupal-курс-лекция-6
Курс по Drupal - лекция 3

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
Modernizing your data center with Dell and AMD
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
NewMind AI Monthly Chronicles - July 2025
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The Rise and Fall of 3GPP – Time for a Sabbatical?
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.

Introduction to Drupal 7 - Content types and fields

  • 1. Introduction to Drupal 7 Session 2.2 Content types and fields Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 1
  • 2. Agenda • What is a content type • Content type settings • Fields • Popular contributed modules Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 2
  • 3. What is a content type • Simply: the most powerful Drupal feature • By default: 2 content types: – Basic page – Article • Unlimited number of custom content types • Many types of fields, no limitations on the number of them Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 3
  • 4. Content type settings • Name and description fields • Submission form settings • Publishing options • Display settings for meta data • Comments settings • Menu settings • Other – when additional modules are enabled Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 4
  • 5. Creating new content type • Administration > Structure > Content types • URL: ../admin/structure/types Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 5
  • 6. Adding news content type example Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 6
  • 7. Fields management • Administration > Structure > Content types • {The content type} > manage fields Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 7
  • 8. Manage Fields vs Manage Displays • Manage fields – Adding new fields – Removing fields – Grouping fields (with additional module) • Order of the fields • Setting labels display • Setting fields contents display • Again, grouping fields in groups (with additional module) Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 8
  • 9. Adding a date field to news • Download/Install Date module • Enable “Date”, “Date API” and “Date Popup” • Go to admin/structure/types/manage/news/fields • Add a new field: – Label: Original publish date – Field type: Date – Machine readable: “orig_pub_date” – Widget type: Pop-up calendar Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 9
  • 10. The date field • Field settings: – Date attributes to collect: leave it as it is, the granularity is good to be by minutes – Collect an end date: leave it as it is, we don’t need to collect end date value – Time zone handling: set to “No time zone conversion” – Cache dates: leave it as it is, we don’t need caching for now Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 10
  • 11. Advanced date field settings • Required field: yes, we want to make sure the user has filled in a value here • Date entry options: set it as you prefer the format to be • Starting year: -0 years from now: we don’t really need more time back • Ending year: +0 years from now: we don’t need more time ahead as well • Default date: set it to “Now” as we want the field to take current time by default • Number of values: set it to “1”, as we need only 1 value Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 11
  • 12. Adding the date field Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 12
  • 13. System date settings Reports will notify you for required date settings. Some recommended options: Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 13
  • 14. Adding an image field Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 14
  • 15. Image field settings • Allowed file extensions: the extensions the user can upload in the field: jpg, png, etc • File directory: used rarely, only if you want the field to store images in specific folder which is not the sites/default/files folder • Maximum and minimum image resolutions: used rarely, only if you want to limit the input dimensions of the images • Maximum upload size: this is the limitation you can set on the physical size of the files • Enabling Alt and Title: good to have if the administrator/editor has some SEO knowledge to populate these meta data • Preview image style: options come from Image style module. The size you specify here is only for the back-end work of the admin • Number of values: from 1 to unlimited, depending on the case • Default image: rarely used, only if a feature or section requires an image, you can set one default to be displayed when the admin does not upload one Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 15
  • 16. Adding tags field • You can use the default existing Tags vocabulary field • Use the ”Autocomplete term widget (tagging)” widget type • Save and create with default settings Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 16
  • 17. Adding tags field • You can either use and existing Category vocabulary field or create one (if the first one is not available) (1st screenshot) • Use the ”Select list” widget type as you want the Category field to be a list of values, only 1 of which can be selected • Set the number of values to be 1, in the Category field settings (second screenshot) Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 17
  • 18. Compiling news content type feature • We can export our News content type configurations into code for better versioning • Make sure you have the Features module enabled and go to Administer > Structure > Features > Create new • Name and description of the feature are arbitrary – anyway aim to specify them logically enough you can remind yourself what the feature is about • You can start with 7.x-1.0 for the version Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 18
  • 19. News content type feature • Select “News” content type from the node bundle components options • Select all fields related to the news content type from the Fields component: all that start with “node-news-…” • Download the feature • Place the feature in your modules directory and enable it Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 19
  • 20. News content type feature Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 20
  • 21. Enabling the News content type • Administration > Structure > Features Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 21
  • 22. Popular contributed modules • Date – for date type fields • Field Group – grouping multiple fields in a fieldset with various options of output • Link – having options for attributes • Email – including validations • Field permissions – for settings permissions on a field-by field level • Media – different media handling • References – referencing nodes and users Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 22
  • 23. Time for questions Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 23
  • 24. Contacts Kalin Chernev – E: kalata@shtrak.eu – T: twitter.com/kalinchernev – U: http://shtrak.eu/kalata Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 24