SlideShare a Scribd company logo
CCK For Code JunkiesCCK For Code Junkies
DrupalCamp - ATLDrupalCamp - ATL
Presented by: Geoff Maxey (cntlscrut)
1o.2.2o1o
This presentation will be available at:
http://maxeydevbox.org/news/camp/cck-code-junkies-session
Feel free to visit and download the slides.
Overview

To create a CCK field that contains multiple
elements, interacts with 3rd
party services,
and can move/create content on a remote
Drupal site.

Understand basic terminology of how CCK
breaks down fields and widgets.

To cover the CCK field/widget API and how
to implement it. Plus, cover the caveats and
other roadblocks that may occur.
Elements

Title

Gallery ID

Featured Links

Search Engine Keywords

Selectable Results

Embed Code from Remote Site
CCK Terms
CCK breaks things down into two different
parts: Fields and Widgets
Fields – The namespace and container for
data.
Widgets – The interaction space wherein we
collect data from the user.
API Overview
Install:

content_notify()
Field:

hook_field_info()

hook_field_settings()

hook_field()
API Overview
Widget:

hook_widget_info()

hook_widget_settings()

hook_widget()
Misc:

hook_content_is_empty()
API Overview
AHAH:

hook_menu()

callback_js() (callback for AHAH actions)
Installation Functions
content_notify() -
Informs CCK of our
field and which
stage in Drupal's
module
install/uninstall
process we are in.
Field Functions
hook_field_info() -
Provide basic info about
our field including the
machine name, display
name, and description.
Field Functions
hook_field_settings() - Allows us to provide data specific to
the set up of our field. We're looking at three different
operations:
'form' – create a settings form for the field.
'save' – perform any special actions when saving the settings
form.
'database columns' – define the schema structure for how
our widget data will be saved in the database.
hook_field_settings – 'form'
hook_field_settings – 'save'
hook_field_settings – 'database columns'
Misc Functions
hook_content_is_empty() -
Perform any action if the
field is empty.
Though this is declared an
“optional” function, it is
actually needed.
Field Functions
hook_field($op, &$node, $field, &$items, $teaser, $page)
Defines how the field will actually store and display its contents.
Possible values for $op:

'delete'

'delete revision'

'insert'

'load'

'prepare translation'

'presave'

'sanitize'

'update'

'validate'
hook_field()
Widget Functions
hook_widget_info() -
Define basic info about our widget.
hook_widget()
Here we can define our form
elements using the FAPI! This
is where the action happens.
Put on your 忍び装束 (shinobi
shiozoku) it's Drupal Ninja
Time!
(code available on site. Too big
for slide.)

More Related Content

PPT
Lecture 5
PDF
PPT
Spread spectrum modulation
KEY
Drupalcon cph
KEY
Field api
PDF
Drupal as a Programmer-Friendly CMS at ConFoo
PDF
Drupal Recipe
PDF
Drupal for Webmasters by Brett Baker
Lecture 5
Spread spectrum modulation
Drupalcon cph
Field api
Drupal as a Programmer-Friendly CMS at ConFoo
Drupal Recipe
Drupal for Webmasters by Brett Baker

Similar to CCK For Code Junkies (20)

PDF
Drupal Flyover, CMS Expo
PPTX
Drupal For Dummies
PPT
Introduction to Module Development (Drupal 7)
PDF
Drupal 7-api-2010-11-10
PDF
Introduction to Drupal Basics
KEY
PPT
Beginner's guide to drupal
ODP
From CCK to Entities in Drupal: New Power Tools
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
PPTX
Rapid site production with Drupal
PPT
Module Madness
PDF
Presentation Drupal Content Management Framework
PDF
Drupal training-by-ruchiwebsolutions
KEY
D7 entities fields
PDF
Okay, I've downloade
PDF
13th Sep, Drupal 7 advanced training by TCS
KEY
Fields in Core: How to create a custom field
KEY
Building University Websites with the Drupal Content Management System
ODP
Custom module and theme development in Drupal7
KEY
drupal 7 amfserver presentation: integrating flash and drupal
Drupal Flyover, CMS Expo
Drupal For Dummies
Introduction to Module Development (Drupal 7)
Drupal 7-api-2010-11-10
Introduction to Drupal Basics
Beginner's guide to drupal
From CCK to Entities in Drupal: New Power Tools
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Rapid site production with Drupal
Module Madness
Presentation Drupal Content Management Framework
Drupal training-by-ruchiwebsolutions
D7 entities fields
Okay, I've downloade
13th Sep, Drupal 7 advanced training by TCS
Fields in Core: How to create a custom field
Building University Websites with the Drupal Content Management System
Custom module and theme development in Drupal7
drupal 7 amfserver presentation: integrating flash and drupal
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MYSQL Presentation for SQL database connectivity
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
MIND Revenue Release Quarter 2 2025 Press Release
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Ad

CCK For Code Junkies

Editor's Notes

  • #9: The callback_js can be any name that you wish. This is you custom callback for handling actions in the AHAH functionality.
  • #10: We must remember that at this point we are actively defining a DB schema. We are letting CCK do the work for us. We will define our data structure later, though in a different function without the use of the schmea api.
  • #15: I apologize if this may be a little hard to read but, it was the only way I could fit it in the slide. Pretty much we are defining our fields as we would using the schema api. Each array should be keyed by the machine name that we will use when defining our form elements later when we're building our widget.
  • #18: You'll notice that I'm only using the sanitize operation. I'm doing this because I want to let CCK handle the opeations with its own default handling. I do not need to provide any extra data at this point. I'm skipping covering the sanitize function that I wrote because it deals with a very specific problem that many would not have to deal with.