update to D 7.17

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2012-12-08 11:35:42 +01:00
parent 975d758599
commit 5396b3e2b5
284 changed files with 3674 additions and 1854 deletions

View File

@@ -690,11 +690,10 @@ function hook_field_is_empty($item, $field) {
* which widget to use. Widget types are defined by implementing
* hook_field_widget_info().
*
* Widgets are
* @link http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html Form API @endlink
* elements with additional processing capabilities. Widget hooks are typically
* called by the Field Attach API during the creation of the field form
* structure with field_attach_form().
* Widgets are @link forms_api_reference.html Form API @endlink elements with
* additional processing capabilities. Widget hooks are typically called by the
* Field Attach API during the creation of the field form structure with
* field_attach_form().
*
* @see field
* @see field_types
@@ -729,6 +728,9 @@ function hook_field_is_empty($item, $field) {
* - FIELD_BEHAVIOR_DEFAULT: (default) If the widget accepts default
* values.
* - FIELD_BEHAVIOR_NONE: if the widget does not support default values.
* - weight: (optional) An integer to determine the weight of this widget
* relative to other widgets in the Field UI when selecting a widget for a
* given field instance.
*
* @see hook_field_widget_info_alter()
* @see hook_field_widget_form()
@@ -738,7 +740,7 @@ function hook_field_is_empty($item, $field) {
* @see hook_field_widget_settings_form()
*/
function hook_field_widget_info() {
return array(
return array(
'text_textfield' => array(
'label' => t('Text field'),
'field types' => array('text'),
@@ -765,6 +767,8 @@ function hook_field_widget_info() {
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
'default value' => FIELD_BEHAVIOR_DEFAULT,
),
// As an advanced widget, force it to sink to the bottom of the choices.
'weight' => 2,
),
);
}
@@ -1072,8 +1076,8 @@ function hook_field_formatter_info() {
* Perform alterations on Field API formatter types.
*
* @param $info
* Array of informations on formatter types exposed by
* hook_field_field_formatter_info() implementations.
* An array of information on formatter types exposed by
* hook_field_formatter_info() implementations.
*/
function hook_field_formatter_info_alter(&$info) {
// Add a setting to a formatter type.

View File

@@ -6,7 +6,38 @@
*/
/**
* Create a separate form element for each field.
* Creates a form element for a field and can populate it with a default value.
*
* If the form element is not associated with an entity (i.e., $entity is NULL)
* field_get_default_value will be called to supply the default value for the
* field. Also allows other modules to alter the form element by implementing
* their own hooks.
*
* @param $entity_type
* The type of entity (for example 'node' or 'user') that the field belongs
* to.
* @param $entity
* The entity object that the field belongs to. This may be NULL if creating a
* form element with a default value.
* @param $field
* An array representing the field whose editing element is being created.
* @param $instance
* An array representing the structure for $field in its current context.
* @param $langcode
* The language associated with the field.
* @param $items
* An array of the field values. When creating a new entity this may be NULL
* or an empty array to use default values.
* @param $form
* An array representing the form that the editing element will be attached
* to.
* @param $form_state
* An array containing the current state of the form.
* @param $get_delta
* Used to get only a specific delta value of a multiple value field.
*
* @return
* The form element array created for this field.
*/
function field_default_form($entity_type, $entity, $field, $instance, $langcode, $items, &$form, &$form_state, $get_delta = NULL) {
// This could be called with no entity, as when a UI module creates a
@@ -278,7 +309,7 @@ function theme_field_multiple_value_form($variables) {
$header = array(
array(
'data' => '<label>' . t('!title: !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",
'data' => '<label>' . t('!title !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",
'colspan' => 2,
'class' => array('field-label'),
),

View File

@@ -10,8 +10,8 @@ dependencies[] = field_sql_storage
required = TRUE
stylesheets[all][] = theme/field.css
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -54,8 +54,8 @@ function field_info_cache_clear() {
* the field type.
* - 'widget types': Array of hook_field_widget_info() results, keyed by
* widget_type. Each element has the following components: label, field
* types, settings, and behaviors from hook_field_widget_info(), as well
* as module, giving the module that exposes the widget type.
* types, settings, weight, and behaviors from hook_field_widget_info(),
* as well as module, giving the module that exposes the widget type.
* - 'formatter types': Array of hook_field_formatter_info() results, keyed by
* formatter_type. Each element has the following components: label, field
* types, and behaviors from hook_field_formatter_info(), as well as
@@ -124,6 +124,7 @@ function _field_info_collate_types($reset = FALSE) {
}
}
drupal_alter('field_widget_info', $info['widget types']);
uasort($info['widget types'], 'drupal_sort_weight');
// Populate formatter types.
foreach (module_implements('field_formatter_info') as $module) {
@@ -702,6 +703,10 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
* The field name for the instance.
* @param $bundle_name
* The bundle name for the instance.
*
* @return
* An associative array of instance data for the specific field and bundle;
* NULL if the instance does not exist.
*/
function field_info_instance($entity_type, $field_name, $bundle_name) {
$info = _field_info_collate_fields();

View File

@@ -172,7 +172,7 @@ function field_schema() {
* This function can be used for databases whose schema is at field module
* version 7000 or higher.
*
* @ingroup update-api-6.x-to-7.x
* @ingroup update_api
*/
function _update_7000_field_create_field(&$field) {
// Merge in default values.`
@@ -253,7 +253,7 @@ function _update_7000_field_create_field(&$field) {
* @param $field_name
* The field name to delete.
*
* @ingroup update-api-6.x-to-7.x
* @ingroup update_api
*/
function _update_7000_field_delete_field($field_name) {
$table_name = 'field_data_' . $field_name;
@@ -284,7 +284,7 @@ function _update_7000_field_delete_field($field_name) {
*
* This function is valid for a database schema version 7000.
*
* @ingroup update-api-6.x-to-7.x
* @ingroup update_api
*/
function _update_7000_field_delete_instance($field_name, $entity_type, $bundle) {
// Delete field instance configuration data.
@@ -322,6 +322,8 @@ function _update_7000_field_delete_instance($field_name, $entity_type, $bundle)
* @return
* An array of fields matching $conditions, keyed by the property specified
* by the $key parameter.
*
* @ingroup update_api
*/
function _update_7000_field_read_fields(array $conditions = array(), $key = 'id') {
$fields = array();
@@ -356,7 +358,7 @@ function _update_7000_field_read_fields(array $conditions = array(), $key = 'id'
* This function can be used for databases whose schema is at field module
* version 7000 or higher.
*
* @ingroup update-api-6.x-to-7.x
* @ingroup update_api
*/
function _update_7000_field_create_instance($field, &$instance) {
// Merge in defaults.

View File

@@ -376,7 +376,7 @@ function field_system_info_alter(&$info, $file, $type) {
}
if ($non_deleted) {
if (module_exists('field_ui')) {
$explanation = t('Field type(s) in use - see !link', array('!link' => l(t('Field list'), 'admin/reports/fields')));
$explanation = t('Field type(s) in use - see <a href="@fields-page">Field list</a>', array('@fields-page' => url('admin/reports/fields')));
}
else {
$explanation = t('Fields type(s) in use');

View File

@@ -7,8 +7,8 @@ dependencies[] = field
files[] = field_sql_storage.test
required = TRUE
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -30,7 +30,7 @@ function field_sql_storage_schema() {
* This function can be used for databases whose schema is at field module
* version 7000 or higher.
*
* @ingroup update-api-6.x-to-7.x
* @ingroup update_api
*/
function _update_7000_field_sql_storage_write($entity_type, $bundle, $entity_id, $revision_id, $field_name, $data) {
$table_name = "field_data_{$field_name}";

View File

@@ -7,8 +7,8 @@ dependencies[] = field
dependencies[] = options
files[] = tests/list.test
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -5,8 +5,8 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -6,8 +6,8 @@ core = 7.x
dependencies[] = field
files[] = number.test
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -6,8 +6,8 @@ core = 7.x
dependencies[] = field
files[] = options.test
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -7,8 +7,8 @@ dependencies[] = field
files[] = text.test
required = TRUE
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -1119,8 +1119,11 @@ class FieldInfoTestCase extends FieldTestCase {
'test_setting' => 999)));
field_create_instance($instance);
$info = entity_get_info('test_entity');
$instances = field_info_instances('test_entity', $instance['bundle']);
$this->assertEqual(count($instances), 1, t('One instance shows up in info when attached to a bundle.'));
$this->assertEqual(count($instances), 1, format_string('One instance shows up in info when attached to a bundle on a @label.', array(
'@label' => $info['label']
)));
$this->assertTrue($instance < $instances[$instance['field_name']], t('Instance appears in info correctly'));
// Test a valid entity type but an invalid bundle.

View File

@@ -23,7 +23,7 @@ function field_test_entity_info() {
return array(
'test_entity' => array(
'name' => t('Test Entity'),
'label' => t('Test Entity'),
'fieldable' => TRUE,
'field cache' => FALSE,
'base table' => 'test_entity',
@@ -38,7 +38,7 @@ function field_test_entity_info() {
),
// This entity type doesn't get form handling for now...
'test_cacheable_entity' => array(
'name' => t('Test Entity, cacheable'),
'label' => t('Test Entity, cacheable'),
'fieldable' => TRUE,
'field cache' => TRUE,
'entity keys' => array(
@@ -50,7 +50,7 @@ function field_test_entity_info() {
'view modes' => $test_entity_modes,
),
'test_entity_bundle_key' => array(
'name' => t('Test Entity with a bundle key.'),
'label' => t('Test Entity with a bundle key.'),
'base table' => 'test_entity_bundle_key',
'fieldable' => TRUE,
'field cache' => FALSE,
@@ -63,7 +63,7 @@ function field_test_entity_info() {
),
// In this case, the bundle key is not stored in the database.
'test_entity_bundle' => array(
'name' => t('Test Entity with a specified bundle.'),
'label' => t('Test Entity with a specified bundle.'),
'base table' => 'test_entity_bundle',
'fieldable' => TRUE,
'controller class' => 'TestEntityBundleController',
@@ -77,7 +77,7 @@ function field_test_entity_info() {
),
// @see EntityPropertiesTestCase::testEntityLabel()
'test_entity_no_label' => array(
'name' => t('Test entity without label'),
'label' => t('Test entity without label'),
'fieldable' => TRUE,
'field cache' => FALSE,
'base table' => 'test_entity',
@@ -90,7 +90,7 @@ function field_test_entity_info() {
'view modes' => $test_entity_modes,
),
'test_entity_label' => array(
'name' => t('Test entity label'),
'label' => t('Test entity label'),
'fieldable' => TRUE,
'field cache' => FALSE,
'base table' => 'test_entity',
@@ -104,7 +104,7 @@ function field_test_entity_info() {
'view modes' => $test_entity_modes,
),
'test_entity_label_callback' => array(
'name' => t('Test entity label callback'),
'label' => t('Test entity label callback'),
'fieldable' => TRUE,
'field cache' => FALSE,
'base table' => 'test_entity',

View File

@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
version = VERSION
hidden = TRUE
; Information added by drupal.org packaging script on 2012-10-17
version = "7.16"
; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1350508567"
datestamp = "1352325357"

View File

@@ -40,6 +40,8 @@
*
* @see template_preprocess_field()
* @see theme_field()
*
* @ingroup themeable
*/
?>
<!--