outline working together working with nodes working with blocks working with taxonomy the form api...

32

Upload: edgar-sullivan

Post on 04-Jan-2016

240 views

Category:

Documents


2 download

TRANSCRIPT

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

Working togetherq=user/

131$op =

view

Working togetherq=user/

131/edit$op =

view

Working togetherfunction user_view($uid = 0) {…foreach (module_list() as $module) {

if ($data = module_invoke($module, 'user', 'view', '', $account)) {

foreach ($data as $category => $items){foreach ($items as $key => $item){

$item['class'] = "$module-". $item['class']; $fields[$category][$key] = $item;

} }

} }…}

Working togetherFunction XXXXX_user($op, &$edit, &$user,

$category=NULL) {….

}

Working togetherfunction profile_user($op, &$edit, &$user,

$category = NULL) { switch ($op) {

…case 'view': return

profile_view_profile($user); …

}}

Working together$op

After_updateDeleteFormInsertLoginLogoutLoadRegisterSubmitUpdateValidateView

Working togetherfunction tracker_menu($may_cache) {

……else {

if (arg(0) == 'user' && is_numeric(arg(1))) {

$items[] = array('path' => 'user/'. arg(1) .'/track', …);

} ……

}

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

Working with Nodes

Working with NodesNot Everything is a Node

UsersBlocksComments

Working with NodesMyNode

MyNode_install (.install)MyNode_node_info (.module)MyNode_menu (url mapping)MyNode_perm (permission)MyNode_access (access control)MyNode_form (input form)MyNode_validateMyNode_insert (insert to DB)MyNode_update (update to DB)MyNode_delete (delete from DB)MyNode_loadMyNode_view

Working with Nodes

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

Working with Blocks

Working with Blocks

Working with Blocks

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

Working with TaxonomyTaxonomy is classification of thingsTerms ~ tags.Assigning terms ~ taggingSynonyms

Working with Taxonomy

Working with Taxonomy

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

The Form API

Fieldset

Textfield

The Form API$form[‘name’] = array(

‘#title’ => t(‘Your Name’),‘#type’ => ‘fieldset’,‘#description’ => t(‘Please enter your name.’)

); Fieldset

The Form API$form[‘name’][‘user_name’] = array(

‘#title’ => t(‘Your Name’),‘#type’ => ‘textfield’,‘#description’ => t(‘Please enter your name.’)

);Textfield

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

jQueryhttp://jquery.comWrite PHP in place of JavaScript

jQueryJavaScript

window.onload = function{ /*your code*/ }

PHP with jQuery$(document).ready( function{ /*your code*/ } );

Drupal with jQuerydrupal_add_js(‘$(document).ready( function{ /*your code*/ } );’, ‘inline’);

jQueryjQuery (Drupal 5.0+)Xajax (PHP library)Prototype (JavaScript)Yahoo UI (YUI) (JavaScript)

OutlineWorking togetherWorking with NodesWorking with BlocksWorking with TaxonomyThe Form APIjQuerySummary

SummarySimple frameworkDevelop fastWork together

Work flow?Dependence sequence?