Fields in Core

The Fields in Core working group aims to include CCK-like functionality in Drupal 7 and beyond. During the week of December 15, we're organizing a 5-day Fields in Drupal core code sprint at Acquia! To help us fund the sprint, please consider making a donation using the ChipIn widget on the announcement page. We need money for airline tickets, hotel rooms, food and transportation. It would also be great to fly in a few additional people with extensive core and CCK experience.

DwightAspinwall's picture

Request for feedback on best practices in overcoming query performance problems in D6 and beyond

It is well-known that many very useful queries that you create (on your own or via the Views module) are costly to execute because MySQL creates a temporary table and does a filesort. A common example is {node}.type='xxx' and {node}.status='yyy' order by {node_comment_statistics}.comment_count desc.

Another common example is sorting posts in reverse chron order of most recent comment timestamp, which the Views module implements as order by GREATEST({node}.changed, {node_comment_statistics}.last_comment_timestamp) DESC

Login to post comments · Read more

D6 -> D7 field upgrade tasks

This wiki page lists the steps for CCK D6 -> Code D7 fields upgrade.
It is based on a list KarenS maintained a few months ago, and might be incomplete or partially out of date.

Each field type will have its own bunch of reshuffling of the $field into the $field and $instance structures.

  • Add new columns for:
    • deleted: defaults to 0
    • data: contains serialized array of complete $instance.
  • Module-defined field settings are now at $field['settings'][...]
Login to post comments · Read more

UI-oriented summary of D7 Field API

This Wiki page summarizes the UI needs for the D7 Field API, to get the ball rolling on design discussions.
Discussion currently takes place in the comments here - or is there any other place more in line with D7UX habits ?

Introduction

A good UI for D7 Field API remains to be invented - esp. when considering a couple new features compared to CCK D6.

7 comments · Read more

Fields UI (in Core)

With Field API in Core I think we are shooting ourselves in the foot if we ship without a UI for it.

That having been said, let's see where we are at.
The Current Field UI / CCK UI still lives in contrib because it is said to be too complex or downright bad to belong in core.
Hence, if we want a Field UI in core we need to make it less complex. If you visit admin/build/types with CCK UI enabled you have have an admin page that needs to achieve all of the following:

  1. Creating content types
  2. Edit existing content types' settings
7 comments · Read more · 5 attachments
scor's picture

State of the RDF in Drupal core after the code sprint

The objectives of the sprint were to flesh out a lightweight basic design for integrating RDF into Drupal core and implement as much as possible the features we agree on during the sprint.

5 comments · Read more

Translatable fields implementation details

In http://drupal.org/node/367595 the groundwork is being laid for multilingual support in the core fields api.

At a May 21, 2009 IRC meeting to plan translatable fields (see this summary), a consensus emerged that translatable fields should emulate the current Translation module behavior.

With translatable fields we are introducing a second way in which nodes (and other Drupal data objects) can be made translatable, alongside the existing (node-only) one.

The purpose of this wiki page is to begin to map out in detail just how field-based translation will work, taking as our basis the existing node-based translation. For each feature of node-based translation, will there be an equivalent in field-based translation? If so, what will that equivalent look like, and how will it be represented?

Most or all of this will go as follow-up patches to http://drupal.org/node/367595; but it's worth starting to map the work out now.

This page so far has a few preliminary notes and needs a lot of expansion. Please add and edit. What further aspects of the existing node-based translation will we need to emulate in field-based translation? What will we need to consider?

Login to post comments · Read more
Benjamin Melançon's picture

Proposal for RDF mappings in core

Three key functions:

<?php
rdf_get_mapping
($bundle);  // @TODO this should be 'container' or something more generic than even bundle
?>

From rdf.api.php in the development bzr repository we get definitions for our two hook functions:

<?php
/**
* Allow modules to define their own RDF mappings.
*
* @return
* An associative array of mappings. Most keys will be bundle names, but
* mappings can also be defined for non-bundles.
*/
function hook_rdf_mapping() {
return array(

Read more
Benjamin Melançon's picture

Proposal for RDF in Contrib, storing and loading, after first day of sprint

To become an update for the issue RDFa: Add semantics from the ground up:

UPDATE ON THE UPDATE: This is the approach we think could be taken in contrib for RDF, and the original title Proposal for RDFa in Core, storing and loading, after first day of sprint has been changed. You can see the current approach over here.

Our CRUD functions:
<?php
rdf_mapping_create($bundle, $attribute, $rdf_term);
rdf_mapping_read($bundle, $attribute = NULL);

8 comments · Read more · 2 attachments
scor's picture

RDF in core code sprint

Start: 
2009-05-11 10:00 - 2009-05-14 17:00 UTC
Organizers: 

There are only a few months left before the code freeze on September 1st. Now that Fields API has settled in core, it's time to extend it with some RDF semantics. DERI Galway is hosting an RDF in Drupal code sprint during the week of May 11th until May 14th.

Goals of the code sprint

The RDF code sprint will focus on Drupal core and aim at integrating RDF semantics in it.

  1. Extend Fields API to integrate RDF mappings for each field instance. The semantics of a field can differ from a bundle to another. This can be stored either in the existing settings property or by adding a rdf_mappings property to the Field Instance objects.
  2. Modify the Fields UI (contrib) to allow RDF mappings editing.
  3. Define the appropriate mappings for the core modules, based on the RDF core mapping proposal.
  4. Patch core modules with the mappings defined above.
  5. Export these mappings in RDFa via the theme layer and keep it as generic as possible in order to ease the work of the themers.
  6. Write tests for RDF in core.
  7. Identify other non-fieldable entities in core which could benefit from being RDF-ized, and see how to annotate them. Comment is one example. Terms also, though they might become fieldable.
  8. RSS 1 (RDF) in core. Arto volunteered to get started with that.
10 comments · Read more

$form['#fields'] and widgets

I've been experimenting with implementing complex fields by creating a field type that's also a fieldable entity.

But I've run into some problems in the form department. The issue is that $form['#fields'] makes it rather difficult to include a field in a complex element, when field implementations expect the form global #fields to include the the field and instance. It's 'just' form API #process functions that seems to be the problem.

3 comments · Read more
frankcarey's picture

Extreame fields: Title and Body as fields for nodes; 'mail' (email) and 'name' (username) as fields for user

Has anyone talked about devolving title, body(for nodes) and mail and name for users into fields

One reason for this would be to have mail and name be non-unique if a setup called for that. See this comment.
http://drupal.org/node/394282#comment-1408924

If anyone has discussed this somewhere let me know?

2 comments

Combo field/Multigroup to create one-off complex field tables

I've been thinking about the concerns about storing fields in separate tables and have another idea to knock around. Storing each simple field in its own table could obviously result in a lot of tables for each content type, but storing a few complex fields could significantly reduce the number of tables involved. So another option is to make it easier to create a complex fields to match the needs of a particular system. If that was easier to do, anyone concerned about performance could combine the fields they need into a smaller number (or even a single) complex field.

4 comments · Read more
bjaspan's picture

Per-Bundle storage module

Today I mostly goofed off at work and created the Per-Bundle Storage module (pbs.module), a Field API contrib module that stores all values for all limited-value fields in a bundle in a single table row. Per-bundle storage is the exact analog of pre-Field API CCK's per-content-type storage and thus provides the same benefits (namely, loading all such fields in a single query).

10 comments · Read more
bjaspan's picture

Renaming Field API groups

We currently have three Field API groups: CRUD, Type, and Attach. As recently as Monday, chx was confused about what these names mean; he thought "Attach" was for attaching a field to a bundle. If he can be confused, then the names are just confusing. I propose that we change them as follows:

2 comments · Read more
bjaspan's picture

Serialized data in FCI

We have a task for cleaning up the serialized data in the field_config_instance table. This includes preventing duplicate/inconsistent data from existing in the serialized data column and other columns, and considering whether some data now in the serialized column that did not used to be should in fact go back into its own column.

1. Preventing duplicate/inconsistent data

In _field_write_instance, we previously wrote $instance (the whole record) into the 'data' column. I changed the code like this:

<?php
// Create $data to contain everything from $instance that does not

2 comments · Read more

Translation of Field Labels

Current code is full of t($instance['label']) as a CCK legacy.
I know that this is not the recommended way to make user-defined strings translatable, but I'm not sure what the right way is.

1 comment

field_attach_*() calls

Taken from email discussion - Quick summary :

chx :

drupal_function_exists('field_attach_*');
field_attach_*(...);

is ugly, we should do :
module_invoke('field', 'attach_*', ...);

yched : This doesn't work because for this forbids reference-altering the arguments

chx: Then let's use the 1st form when by-ref args are needed and the 2nd one for the rest.

(end of summary)

10 comments · Read more
bjaspan's picture

Convert field form data to object properties

I think we need another Field Attach API function.

Currently, a fieldable entity calls field_attach_form($obj_type, $obj, $form, $form_state) to load the appropriate field elements into $form for editing $obj. Later, it calls field_attach_validate(..., $form, $form_state) so the field widgets can perform their validation. Eventually, it will call field_attach_insert($obj_type, $obj) or field_attach_update($obj_type, $obj) to store the field data in the database.

11 comments · Read more
bjaspan's picture

field_attach_load_single() for MV

We have a Field CRUD API task: "CRUD: API to load single field for single entity: Should take field, entity, and entity_id as arguments. Needed for Materialized Views."

I started to write this function, thinking it would be easy (ha). I decided to make it exactly like field_attach_load() except for a single object and with another argument for the single field to load, like this:

<?php
field_attach_load_single
($obj_type, $object, $field = NULL, $age = FIELD_LOAD_CURRENT);
?>

4 comments · Read more
bjaspan's picture

field_attach_delete_revision

field_attach_delete() deletes all fields for the specified object from the current and archive field data tables.

2 comments · Read more

The Fields in Core working group aims to include CCK-like functionality in Drupal 7 and beyond. During the week of December 15, we're organizing a 5-day Fields in Drupal core code sprint at Acquia! To help us fund the sprint, please consider making a donation using the ChipIn widget on the announcement page. We need money for airline tickets, hotel rooms, food and transportation. It would also be great to fly in a few additional people with extensive core and CCK experience.

Syndicate content