All pastes #618541 Raw Edit

CCK Crud brainstorming

public php v1 · immutable
·published 2007-07-14 00:51 UTC
rendered paste body
// Note that this sample code does NOT account for the DB table and column// creation work that CCK does to decide whether things should go into the // content_type_foo table, or a dedicated side table for the field. Triggering// those CCK table/field creation functions still needs to be solved but this// stuff should work OK to map to the basic field schema definition stuff function foo_node_info() {  $types = array(    'foo' => array(      'name' => t('Node type'),      'module' => 'foo',      'description' => t('Stuff goes here!'),    )  );  // Each element in this array has a key that corresponds to  // a CCK field defined in hook_node_field_info(). This sub-array  // of the node definition is used to create the *node_field_instance*  // entry  $types['foo']['fields']['field_bar'] => array(      'label' => 'Foo',      'description' => 'Description of foo',      'widget_type' => 'text',      'widget_settings' => array('stuff in this key gets serialized for db insertion'),      'display_settings' => array('stuff in this key gets serialized for db insertion'),    ),  );  return $types;}// Each element in this array has a corresponds to an entry in the// node_field table.function foo_node_field_info() {  $fields = array(    'field_bar' => array(      'type' => 'text',      'required' => TRUE,      'multiple' => FALSE,      'db_storage' => TRUE,      'settings' => array('stuff in this key gets serialized for db insertion'),    ),  );}