Ele­ment Types and the Ele­ment Ser­vice — Part 2 of 3

This recording is Part 2 the first introduction to Element Types in Craft CMS given to a small group of Craft developers. The presentation takes place 2 weeks before Peers 2014 where Brandon's course on Element Types attracted a full house and introduced Element Types to a larger audience.

This recording is the first introduction to Element Types in Craft CMS given to a small group of Craft developers. The presentation takes place 2 weeks before Peers 2014 where Brandon's course on Element Types attracted a full house and introduced Element Types to a larger audience.

A big thanks to Selvin Ortiz for arranging this meetup and to Brandon Kelly for leading it.

  • 00:00:00 Criteria
  • 00:04:45 Reflection on setting up an Element Type
  • 00:08:44 Elements and the craft_content table
  • 00:17:40 More functions in the Element Type Class: defineCriteriaAttributes(), modifyElementsQuery()
  • 00:18:00 A look at where modifyElementsQuery() gets called in ElementService.php
  • 00:27:48 A few questions on these two functions
  • 00:32:20 A quick look at BaseElementType.php
  • 00:33:00 defineSearchableAttributes() and the difference between a 'title' and a 'name' in Craft
  • 00:35:04 getIndexHtml() and customizing an Element index page
  • 00:37:26 Elements Service buildElementsQuery(), getTotalElements()
  • 00:38:56 findElements()
  • 00:42:54 Turning an array into an Element Model with populateElementModel()
  • 00:43:41 Customize your Element Editor Modal with getEditorHtml()

Level up in Craft CMS with practical examples, snippets, and patterns.
Craft The Planet emails are sent out several times a week.