SlideShare a Scribd company logo
deep dive
deep dive[0] Introduction
$presentation = array(
'Introduction',
'Yii',
'Request Handling',
'Data Structure',
'Module & Plugin Overview',
'Q&A'
);
deep dive[1] Yii
deep dive[1] Yii
Yii is an object-oriented

model-view-controller

framework for PHP.
deep dive[1] Yii
deep dive[1] Yii
}
deep dive[1] Yii
Yii provides a way for
namespaces applications to
interact with each other.
deep dive[1] Yii
Yii provides routing.
deep dive[1] Yii
Yii provides twig.
deep dive[1] Yii
Yii provides error handling.
deep dive[1] Yii
Yii provides events.
deep dive[1] Yii
provides it's own routing.
🖕🖕
deep dive[1] Yii
provides its own twig.
🖕🖕
deep dive[1] Yii
doesn't provide it's
own error handling.
👍 👍
deep dive[1] Yii
doesn't provide it's
own events.
👍 👍
deep dive[1] Elements
use craftservicesElements;
deep dive[1] Elements
In Craft almost
everything is an element.
deep dive[2] Request Handling
Let's look at an incoming
Craft request.
deep dive
0.

The request will only go to
craft if the server routes it
to the index.php file.
[2] Request Handling
deep dive
1. Is it an action?

If the URL begins with
actions/ it gets routed to a
controller.
[2] Request Handling
deep dive
1. Is it an action?

The controller is either
built-in, or provided by a
module or plugin.
[2] Request Handling
deep dive
namespace craftcontrollers;
use Craft;
class UsersController extends Controller
{
public function actionLogin()
{
if (!Craft::$app->getUser()->getIsGuest()) {
// Too easy.
return $this->_handleSuccessfulLogin(false);
}
}
}
1. Is it an action?

The controller is
either built-in, or
provided by a
module or plugin.
GET /actions/users/active
POST /

<input type="hidden" name="action" value="users/save-user">
[2] Request Handling
deep dive
2. Is it an element?

Does it match an element's URI?
[2] Request Handling
deep dive
element:

a thing that can hold data
craftelementsAsset
craftelementsCategory
craftelementsEntry
craftelementsGlobalSet
craftelementsMatrixBlock
craftelementsTag
craftelementsUser
verbbsupertableelementsSuperTableBlockElement
[2] Request Handling
deep dive
craft_elements
id 28
fieldLayoutId 31
type craftelementsEntry
enabled 1
craft_elements_sites
id 32
elementId 28
siteId 1
slug about-us
uri company/about-us
[2] Request Handling
deep dive
craft_elements
id 28
fieldLayoutId 31
type craftelementsEntry
enabled 1
[2] Request Handling
deep dive
craft_elements
id 28
fieldLayoutId 31
type craftelementsEntry
enabled 1
craft_elements_sites
id 32
elementId 28
siteId 1
slug about-us
uri company/about-us
routing uri
[2] Request Handling
deep dive
3. Does the URI match a
route or URI rule?
return [
// Route blog/archive/YYYY to a controller action
'blog/archive/<year:d{4}>' => 'controller/action/path',
// Route blog/archive/YYYY to a template
'blog/archive/<year:d{4}>' => ['template' => 'blog/_archive'],
];
config/routes.php
<h1>Blog Entries from {{ year }}</h1>
[2] Request Handling
deep dive
4. Does the URI match a template?
@webroot/templates/single.twig
[2] Request Handling
deep dive
4. Does the URI match a template?
@webroot/templates/single.twig
Yii alias
[2] Request Handling
deep dive
5.Well I guess we'll just 404.
[2] Request Handling
deep dive[3] Data Structure
Let's visualize the
CraftCMS DB Structure
CraftCMS 3.x Deep Dive
deep dive
Ok maybe let's not do that.
[3] Data Structure
deep dive
Let's look at the
Wordpress schema.
[3] Data Structure
CraftCMS 3.x Deep Dive
deep dive[4] Module & Plugin Overview
Not suited for the complex
content architecture we require.
deep dive[4] Module & Plugin Overview
Let's talk about plugins.
deep dive
Plugins and modules are
basically justYii modules
(sort of like Craft is!)
[4] Module & Plugin Overview
deep dive
Plugins:
Installed through Composer,

can be turned on and off in admin.

(Usually) site-agnostic functionality
Modules:
Hardcoded into composer andYii
configs. Cannot be turned off in admin.

(Usually) site-specific functionality
[4] Module & Plugin Overview
deep dive[4] Module & Plugin Overview
deep dive
This is meta because Craft implements
all of these things on its own.
[4] Module & Plugin Overview
deep dive
CSS, JS, and Images needed in the
Admin side of Craft
[4] Module & Plugin Overview
deep dive
Tasks that can be run through
the Craft CLI
[4] Module & Plugin Overview
deep dive
Endpoints that are accessible
through a URL path
[4] Module & Plugin Overview
deep dive
Main application class file.
Registers hooks, events, etc
[4] Module & Plugin Overview
deep dive
New elements (like SuperTable
Blocks for example)
[4] Module & Plugin Overview
deep dive
New fields (like a markdown
editor that stores HTML)
[4] Module & Plugin Overview
deep dive
New queued tasks (like image
transformation)
[4] Module & Plugin Overview
deep dive
Installation / uninstallation
migrations
[4] Module & Plugin Overview
deep dive
A "template" for a custom data
structure
[4] Module & Plugin Overview
deep dive
A way to represent data
from a model and define
how it is stored / retrieved in
the DB
[4] Module & Plugin Overview
deep dive
The "business logic" of the
application/plugin/module
[4] Module & Plugin Overview
deep dive
Twig templates for the admin
side of your plugin
[4] Module & Plugin Overview
deep dive
Functional additions toTwig
(like twig-dig!)
[4] Module & Plugin Overview
deep dive
Add twig pages that appear
under "Utilities" in the Admin
[4] Module & Plugin Overview
deep dive
Add custom twig variables
accessible under the craft
namespace. (Like
{{ craft.testvariable }})
[4] Module & Plugin Overview
deep dive
Widgets for the admin dashboard.
[4] Module & Plugin Overview
deep dive[5] Q & A
Q&A

More Related Content

PPSX
JQuery Comprehensive Overview
PPT
J query intro_29thsep_alok
PPT
Introduction to j query
PDF
WordPress hooks - WPLDN July 2013 Meetup
PPTX
d.mix: Programming by a Sample
PDF
Getting startedwith noir-clojureexchange-2011
PPTX
Jquery dojo slides
JQuery Comprehensive Overview
J query intro_29thsep_alok
Introduction to j query
WordPress hooks - WPLDN July 2013 Meetup
d.mix: Programming by a Sample
Getting startedwith noir-clojureexchange-2011
Jquery dojo slides

Similar to CraftCMS 3.x Deep Dive (20)

PPTX
Introduction to jQuery
PPTX
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
PDF
Get things done with Yii - quickly build webapplications
PPTX
Working with AngularJS
PPT
Yii php framework_honey
PDF
Reactive Type safe Webcomponents with skateJS
PDF
Upgrading Drupal Modules - php[world] 2015
PPTX
NZYP Project Casestudy using SilverStripe CMS
PDF
Rack - O hério oculto de aplicações web Rub.pdf
PDF
Building an Angular 2 App
ODP
WordPress Accessibility: WordCamp Chicago
PDF
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
PPT
Behavior Driven Development (BDD) and Agile Testing
PPTX
Dynamic Actions, the Hard Parts
PDF
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
PDF
Architecting your Frontend
PPTX
Smwcon spring2011 tutorial applied semantic mediawiki
KEY
WordPress Developers Israel Meetup #1
ODP
Knolx session
Introduction to jQuery
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
Get things done with Yii - quickly build webapplications
Working with AngularJS
Yii php framework_honey
Reactive Type safe Webcomponents with skateJS
Upgrading Drupal Modules - php[world] 2015
NZYP Project Casestudy using SilverStripe CMS
Rack - O hério oculto de aplicações web Rub.pdf
Building an Angular 2 App
WordPress Accessibility: WordCamp Chicago
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Behavior Driven Development (BDD) and Agile Testing
Dynamic Actions, the Hard Parts
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Architecting your Frontend
Smwcon spring2011 tutorial applied semantic mediawiki
WordPress Developers Israel Meetup #1
Knolx session
Ad

More from Digital Surgeons (20)

PDF
Navigating Your Brand Through Covid-19
PDF
SVG Animations
PDF
PDF
Machine learning
PDF
Creating great decks: The Origins, the "Why", and 12 Tips to Make Yours Better.
PDF
The Science of Story: How Brands Can Use Storytelling To Get More Customers
PDF
In Content Strategy, L.E.S.S. is More
PDF
Unlock Your Organization Through Digital Transformation
PDF
Radical Candor: No BS, helping your team create better work.
PDF
Unlocking Creativity: How to Harness the Powers of Design, Art Direction & Cr...
PDF
Fight for Yourself: How to Sell Your Ideas and Crush Presentations
PDF
Typecurious: A Typography Crash Course
PDF
Better Twitch Broadcasting through Rapid Prototyping & Human Centered Design
PDF
How to Stream Video Games: A Primer on Twitch.tv
PDF
Art, Meet Copy: A Copywriting Primer for Designers
PDF
Creating Powerful Customer Experiences
PDF
How to Build a Brand Voice Toolkit
PDF
Design Thinking: The one thing that will transform the way you think
PDF
What You Need to Know About the Future of Wearable Technology
PDF
How YouTube is Drastically Changing the Beauty Industry
Navigating Your Brand Through Covid-19
SVG Animations
Machine learning
Creating great decks: The Origins, the "Why", and 12 Tips to Make Yours Better.
The Science of Story: How Brands Can Use Storytelling To Get More Customers
In Content Strategy, L.E.S.S. is More
Unlock Your Organization Through Digital Transformation
Radical Candor: No BS, helping your team create better work.
Unlocking Creativity: How to Harness the Powers of Design, Art Direction & Cr...
Fight for Yourself: How to Sell Your Ideas and Crush Presentations
Typecurious: A Typography Crash Course
Better Twitch Broadcasting through Rapid Prototyping & Human Centered Design
How to Stream Video Games: A Primer on Twitch.tv
Art, Meet Copy: A Copywriting Primer for Designers
Creating Powerful Customer Experiences
How to Build a Brand Voice Toolkit
Design Thinking: The one thing that will transform the way you think
What You Need to Know About the Future of Wearable Technology
How YouTube is Drastically Changing the Beauty Industry
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...

CraftCMS 3.x Deep Dive