commit 25b16dd7ac0cdac7e40ccbdf287fb242a64c13c1 Author: Florian Weber Date: Fri Jun 28 22:03:34 2013 +0100 Fixed the bad re-roll. diff --git a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php index 1ecd132..ea4073b 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php +++ b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php @@ -107,51 +107,6 @@ public function prepareCache() { } /** -<<<<<<< HEAD - * {@inherotdoc} - */ - public static function prepareView(array $entities_items) { - if ($entities_items) { - // Determine the legacy callback. - $field_type_definition = current($entities_items)->getPluginDefinition(); - $module = $field_type_definition['module']; - $callback = "{$module}_field_prepare_view"; - if (function_exists($callback)) { - $entities = array(); - $instances = array(); - $itemsBC = array(); - foreach ($entities_items as $id => $items) { - $entities[$id] = $items->getParent(); - $instances[$id] = $items->offsetGet(0)->getInstance(); - // We need to remove the empty "prototype" item here. - // @todo Revisit after http://drupal.org/node/1988492. - $items->filterEmptyValues(); - $itemsBC[$id] = $items->getValue(TRUE); - } - - // Determine the entity type, langcode and field. - $entity_type = current($entities)->entityType(); - $langcode = current($entities)->language()->id; - $field = current($instances)->getField(); - - $args = array( - $entity_type, - $entities, - $field, - $instances, - $langcode, - &$itemsBC, - ); - call_user_func_array($callback, $args); - - foreach ($entities_items as $id => $items) { - $items->setValue($itemsBC[$id]); - } - } - } - } - - /** * Returns the legacy callback for a given field type "hook". * * @param string $hook diff --git a/core/modules/node/node.module b/core/modules/node/node.module index de06f68..9d9d48f 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -501,163 +501,6 @@ function node_type_update_nodes($old_id, $new_id) { } /** -<<<<<<< HEAD - * Builds and returns the list of available node types. - * - * The list of types is built by invoking hook_node_info() on all modules and - * comparing this information with the node types in the {node_type} table. - * These two information sources are not synchronized during module installation - * until node_types_rebuild() is called. - * - * @param $rebuild - * (optional) TRUE to rebuild node types. Equivalent to calling - * node_types_rebuild(). Defaults to FALSE. - * - * @return - * An object with two properties: - * - names: Associative array of the names of node types, keyed by the type. - * - types: Associative array of node type objects, keyed by the type. - * Both of these arrays will include new types that have been defined by - * hook_node_info() implementations but not yet saved in the {node_type} - * table. These are indicated in the type object by $type->is_new being set - * to the value 1. These arrays will also include obsolete types: types that - * were previously defined by modules that have now been disabled, or for - * whatever reason are no longer being defined in hook_node_info() - * implementations, but are still in the database. These are indicated in the - * type object by $type->disabled being set to TRUE. - */ -function _node_types_build($rebuild = FALSE) { - $cid = 'node_types:' . language(Language::TYPE_INTERFACE)->id; - - if (!$rebuild) { - $_node_types = &drupal_static(__FUNCTION__); - if (isset($_node_types)) { - return $_node_types; - } - if ($cache = cache()->get($cid)) { - $_node_types = $cache->data; - return $_node_types; - } - } - - $_node_types = (object) array('types' => array(), 'names' => array()); - - foreach (module_implements('node_info') as $module) { - $info_array = module_invoke($module, 'node_info'); - foreach ($info_array as $type => $info) { - $info['type'] = $type; - $_node_types->types[$type] = node_type_set_defaults($info); - $_node_types->types[$type]->module = $module; - $_node_types->names[$type] = $info['name']; - } - } - $query = db_select('node_type', 'nt') - ->addTag('node_type_access') - ->fields('nt') - ->orderBy('nt.type', 'ASC'); - if (!$rebuild) { - $query->condition('disabled', 0); - } - foreach ($query->execute() as $type_object) { - $type_db = $type_object->type; - // Original disabled value. - $disabled = $type_object->disabled; - // Check for node types from disabled modules and mark their types for removal. - // Types defined by the node module in the database (rather than by a separate - // module using hook_node_info) have a base value of 'node_content'. The isset() - // check prevents errors on old (pre-Drupal 7) databases. - if (isset($type_object->base) && $type_object->base != 'node_content' && empty($_node_types->types[$type_db])) { - $type_object->disabled = TRUE; - } - if (isset($_node_types->types[$type_db])) { - $type_object->disabled = FALSE; - } - if (!isset($_node_types->types[$type_db]) || $type_object->modified) { - $_node_types->types[$type_db] = $type_object; - $_node_types->names[$type_db] = $type_object->name; - - if ($type_db != $type_object->orig_type) { - unset($_node_types->types[$type_object->orig_type]); - unset($_node_types->names[$type_object->orig_type]); - } - } - $_node_types->types[$type_db]->disabled = $type_object->disabled; - $_node_types->types[$type_db]->disabled_changed = $disabled != $type_object->disabled; - } - - if ($rebuild) { - foreach ($_node_types->types as $type => $type_object) { - if (!empty($type_object->is_new) || !empty($type_object->disabled_changed)) { - node_type_save($type_object); - } - } - } - - asort($_node_types->names); - - cache()->set($cid, $_node_types, CacheBackendInterface::CACHE_PERMANENT, array('node_types' => TRUE)); - - return $_node_types; -} - -/** - * Clears the node type cache. - */ -function node_type_cache_reset() { - cache()->deleteTags(array('node_types' => TRUE)); - drupal_static_reset('_node_types_build'); -} - -/** - * Sets the default values for a node type. - * - * The defaults are appropriate for a type defined through hook_node_info(), - * since 'custom' is TRUE for types defined in the user interface, and FALSE - * for types defined by modules. (The 'custom' flag prevents types from being - * deleted through the user interface.) Also, the default for 'locked' is TRUE, - * which prevents users from changing the machine name of the type. - * - * @param $info - * (optional) An object or array containing values to override the defaults. - * See hook_node_info() for details on what the array elements mean. Defaults - * to an empty array. - * - * @return - * A node type object, with missing values in $info set to their defaults. - * - * @see hook_node_info() - */ -function node_type_set_defaults($info = array()) { - $info = (array) $info; - $new_type = $info + array( - 'type' => '', - 'name' => '', - 'base' => '', - 'description' => '', - 'help' => '', - 'custom' => 0, - 'modified' => 0, - 'locked' => 1, - 'disabled' => 0, - 'is_new' => 1, - 'has_title' => 1, - 'title_label' => 'Title', - ); - $new_type = (object) $new_type; - - // If the type has no title, set an empty label. - if (!$new_type->has_title) { - $new_type->title_label = ''; - } - if (empty($new_type->module)) { - $new_type->module = $new_type->base == 'node_content' ? 'node' : ''; - } - $new_type->orig_type = isset($info['type']) ? $info['type'] : ''; - - return $new_type; -} - -/** * Implements hook_rdf_mapping(). */ function node_rdf_mapping() {