Example #1
0
/**
 * Additional columns and views need to be added to existing fields.
 * Below is an example using the addtional column and view defined above.
 * my_new_view_additional_data() is schema defined in
 * hook_recline_field_columns.
 */
function hook_update_N(&$sandbox)
{
    $ret = array();
    $fields = field_info_fields();
    foreach ($fields as $field_name => $field) {
        if ($field['type'] == 'recline_field' && $field['storage']['type'] == 'field_sql_storage') {
            foreach ($field['storage']['details']['sql'] as $type => $table_info) {
                foreach ($table_info as $table_name => $columns) {
                    $column_name = _field_sql_storage_columnname($field_name, 'my_new_view_additional_data');
                    // Adding my_new_view_additional_data.
                    if (!db_field_exists($table_name, $column_name)) {
                        // Calling schema defined in hook_recline_field_column().
                        $schema = my_new_view_additional_data();
                        db_add_field($table_name, $column_name, $schema);
                    }
                    // Adding my_new_view.
                    $column_name = _field_sql_storage_columnname($field_name, 'my_new_view');
                    $schema = recline_field_schema();
                    if (!db_field_exists($table_name, $column_name)) {
                        db_add_field($table_name, $column_name, $schema['columns']['my_new_view']);
                    }
                    field_cache_clear();
                }
            }
        }
    }
    return $ret;
}
Example #2
0
 /**
  * Creates a date field from an array of settings values.
  *
  * All values have defaults, only need to specify values that need to be
  * different.
  */
 protected function createDateField($values = array())
 {
     extract($values);
     $field_name = !empty($field_name) ? $field_name : 'field_test';
     $entity_type = !empty($entity_type) ? $entity_type : 'node';
     $bundle = !empty($bundle) ? $bundle : 'story';
     $label = !empty($label) ? $label : 'Test';
     $field_type = !empty($field_type) ? $field_type : 'datetime';
     $repeat = !empty($repeat) ? $repeat : 0;
     $todate = !empty($todate) ? $todate : 'optional';
     $widget_type = !empty($widget_type) ? $widget_type : 'date_select';
     $tz_handling = !empty($tz_handing) ? $tz_handling : 'site';
     $granularity = !empty($granularity) ? $granularity : array('year', 'month', 'day', 'hour', 'minute');
     $year_range = !empty($year_range) ? $year_range : '2010:+1';
     $input_format = !empty($input_format) ? $input_format : variable_get('date_format_html_date', 'Y-m-d') . ' ' . variable_get('date_format_html_time', 'H:i:s');
     $input_format_custom = !empty($input_format_custom) ? $input_format_custom : '';
     $text_parts = !empty($text_parts) ? $text_parts : array();
     $increment = !empty($increment) ? $increment : 15;
     $default_value = !empty($default_value) ? $default_value : 'now';
     $default_value2 = !empty($default_value2) ? $default_value2 : 'blank';
     $default_format = !empty($default_format) ? $default_format : 'long';
     $cache_enabled = !empty($cache_enabled);
     $cache_count = !empty($cache_count) ? $cache_count : 4;
     $field = array('field_name' => $field_name, 'type' => $field_type, 'cardinality' => !empty($repeat) ? FIELD_CARDINALITY_UNLIMITED : 1, 'settings' => array('granularity' => $granularity, 'tz_handling' => $tz_handling, 'timezone_db' => date_get_timezone_db($tz_handling), 'repeat' => $repeat, 'todate' => $todate, 'cache_enabled' => $cache_enabled, 'cache_count' => $cache_count));
     $instance = array('entity_type' => $entity_type, 'field_name' => $field_name, 'label' => $label, 'bundle' => $bundle, 'weight' => -4, 'widget' => array('type' => $widget_type, 'settings' => array('increment' => $increment, 'year_range' => $year_range, 'input_format' => $input_format, 'input_format_custom' => $input_format_custom, 'text_parts' => $text_parts, 'label_position' => 'above'), 'weight' => -4), 'settings' => array('default_value' => $default_value, 'default_value2' => $default_value2));
     $instance['display'] = array('default' => array('label' => 'above', 'type' => 'date_default', 'settings' => array('format_type' => $default_format, 'show_repeat_rule' => 'show', 'multiple_number' => '', 'multiple_from' => '', 'multiple_to' => '', 'fromto' => 'both'), 'module' => 'date', 'weight' => 0), 'teaser' => array('label' => 'above', 'type' => 'date_default', 'weight' => 0, 'settings' => array('format_type' => $default_format, 'show_repeat_rule' => 'show', 'multiple_number' => '', 'multiple_from' => '', 'multiple_to' => '', 'fromto' => 'both'), 'module' => 'date'));
     $field = field_create_field($field);
     $instance = field_create_instance($instance);
     field_info_cache_clear(TRUE);
     field_cache_clear(TRUE);
     // Look at how the field got configured.
     $this->drupalGet("admin/structure/types/manage/{$bundle}/fields/{$field_name}");
     $this->drupalGet("admin/structure/types/manage/{$bundle}/display");
 }
 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $user, $language, $settings, $config_directories;
     // In case a fatal error occurred that was not in the test process read the
     // log to pick up any fatal errors.
     simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE);
     $emailCount = count(state_get('test_email_collector', array()));
     if ($emailCount) {
         $message = format_plural($emailCount, '1 e-mail was sent during this test.', '@count e-mails were sent during this test.');
         $this->pass($message, t('E-mail'));
     }
     // Delete temporary files directory.
     file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10));
     // Remove all prefixed tables.
     $connection_info = Database::getConnectionInfo('default');
     $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
     if (empty($tables)) {
         $this->fail('Failed to find test tables to drop.');
     }
     $prefix_length = strlen($connection_info['default']['prefix']['default']);
     foreach ($tables as $table) {
         if (db_drop_table(substr($table, $prefix_length))) {
             unset($tables[$table]);
         }
     }
     if (!empty($tables)) {
         $this->fail('Failed to drop all prefixed tables.');
     }
     // Get back to the original connection.
     Database::removeConnection('default');
     Database::renameConnection('simpletest_original_default', 'default');
     // Delete the database table prefix record.
     db_delete('simpletest_prefix')->condition('test_id', $this->testId)->condition('prefix', $this->databasePrefix)->execute();
     // Set the configuration direcotires back to the originals.
     $config_directories = $this->originalConfigDirectories;
     // Restore the original settings.
     $settings = $this->originalSettings;
     // Restore original shutdown callbacks array to prevent original
     // environment of calling handlers from test run.
     $callbacks =& backdrop_register_shutdown_function();
     $callbacks = $this->originalShutdownCallbacks;
     // Return the user to the original one.
     $user = $this->originalUser;
     backdrop_save_session(TRUE);
     // Ensure that internal logged in variable and cURL options are reset.
     $this->loggedInUser = FALSE;
     $this->additionalCurlOptions = array();
     // Reload module list and implementations to ensure that test module hooks
     // aren't called after tests.
     module_list(TRUE);
     module_implements_reset();
     // Reset the Field API.
     field_cache_clear();
     // Rebuild caches.
     $this->refreshVariables();
     // Reset public files directory.
     $GLOBALS['conf']['file_public_path'] = $this->originalFileDirectory;
     // Reset language.
     $language = $this->originalLanguage;
     if ($this->originalLanguageDefault) {
         $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
     }
     // Close the CURL handler.
     $this->curlClose();
 }
 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $user, $language;
     // In case a fatal error occurred that was not in the test process read the
     // log to pick up any fatal errors.
     simpletest_log_read($this->testId, $this->databasePrefix, get_class($this), TRUE);
     $emailCount = count(variable_get('drupal_test_email_collector', array()));
     if ($emailCount) {
         $message = format_plural($emailCount, '1 e-mail was sent during this test.', '@count e-mails were sent during this test.');
         $this->pass($message, t('E-mail'));
     }
     // Delete temporary files directory.
     file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10));
     // Remove all prefixed tables (all the tables in the schema).
     $schema = drupal_get_schema(NULL, TRUE);
     foreach ($schema as $name => $table) {
         db_drop_table($name);
     }
     // Get back to the original connection.
     Database::removeConnection('default');
     Database::renameConnection('simpletest_original_default', 'default');
     // Restore original shutdown callbacks array to prevent original
     // environment of calling handlers from test run.
     $callbacks =& drupal_register_shutdown_function();
     $callbacks = $this->originalShutdownCallbacks;
     // Return the user to the original one.
     $user = $this->originalUser;
     drupal_save_session(TRUE);
     // Ensure that internal logged in variable and cURL options are reset.
     $this->loggedInUser = FALSE;
     $this->additionalCurlOptions = array();
     // Reload module list and implementations to ensure that test module hooks
     // aren't called after tests.
     module_list(TRUE);
     module_implements('', FALSE, TRUE);
     // Reset the Field API.
     field_cache_clear();
     // Rebuild caches.
     $this->refreshVariables();
     // Reset language.
     $language = $this->originalLanguage;
     if ($this->originalLanguageDefault) {
         $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
     }
     // Close the CURL handler.
     $this->curlClose();
 }
 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix, $user, $language;
     // In case a fatal error occured that was not in the test process read the
     // log to pick up any fatal errors.
     $db_prefix_temp = $db_prefix;
     $db_prefix = $this->originalPrefix;
     simpletest_log_read($this->testId, $db_prefix, get_class($this), TRUE);
     $db_prefix = $db_prefix_temp;
     $emailCount = count(variable_get('drupal_test_email_collector', array()));
     if ($emailCount) {
         $message = format_plural($emailCount, t('!count e-mail was sent during this test.'), t('!count e-mails were sent during this test.'), array('!count' => $emailCount));
         $this->pass($message, t('E-mail'));
     }
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory.
         file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10));
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Return the user to the original one.
         $user = $this->originalUser;
         drupal_save_session(TRUE);
         // Ensure that internal logged in variable and cURL options are reset.
         $this->loggedInUser = FALSE;
         $this->additionalCurlOptions = array();
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements('', FALSE, TRUE);
         // Reset the Field API.
         field_cache_clear();
         // Rebuild caches.
         $this->refreshVariables();
         // Reset language.
         $language = $this->originalLanguage;
         if ($this->originalLanguageDefault) {
             $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
         }
         // Close the CURL handler.
         $this->curlClose();
     }
 }
Example #6
0
 /**
  * Delete a field.
  *
  * This is a clone of field_delete_field() that works for inactive fields.
  *
  * @param array $field
  *   The field definition. This may be deleted or inactive.
  * @param bool $purge
  *
  * @throws FieldException
  */
 public static function deleteField(array $field, $purge = TRUE)
 {
     $field = static::readFieldById($field['id']);
     if (empty($field)) {
         throw new FieldException();
     }
     if (!module_exists($field['storage']['module'])) {
         throw new FieldException("The {$field['storage']['module']} module needs to be enabled in order to delete field ID {$field['id']}.");
     }
     if ($instances = field_read_instances(array('field_id' => $field['id']), array('include_deleted' => TRUE, 'include_inactive' => TRUE))) {
         foreach ($instances as $instance) {
             static::deleteInstance($instance, $purge, FALSE);
         }
     }
     if (empty($field['deleted'])) {
         // Mark field data for deletion.
         module_invoke($field['storage']['module'], 'field_storage_delete_field', $field);
         // Mark the field for deletion.
         db_update('field_config')->fields(array('deleted' => 1))->condition('field_name', $field['field_name'])->execute();
         // Clear the cache.
         field_cache_clear(TRUE);
         module_invoke_all('field_delete_field', $field);
         watchdog('helper', "Marked field ID {$field['id']} for deletion.");
     }
     if ($purge) {
         static::purgeField($field);
     }
 }
 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix, $user;
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         file_unmanaged_delete_recursive(file_directory_path());
         variable_set('file_directory_path', $this->originalFileDirectory);
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Return the user to the original one.
         $user = $this->originalUser;
         drupal_save_session(TRUE);
         // Ensure that internal logged in variable and cURL options are reset.
         $this->loggedInUser = FALSE;
         $this->additionalCurlOptions = array();
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
         // Reset the Field API.
         field_cache_clear();
         // Rebuild caches.
         $this->refreshVariables();
         // Close the CURL handler.
         $this->curlClose();
     }
 }
 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix, $user, $language;
     $emailCount = count(variable_get('simpletest_emails', array()));
     if ($emailCount) {
         $message = format_plural($emailCount, t('!count e-mail was sent during this test.'), t('!count e-mails were sent during this test.'), array('!count' => $emailCount));
         $this->pass($message, t('E-mail'));
     }
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         file_unmanaged_delete_recursive(file_directory_path());
         variable_set('file_directory_path', $this->originalFileDirectory);
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Return the user to the original one.
         $user = $this->originalUser;
         drupal_save_session(TRUE);
         // Ensure that internal logged in variable and cURL options are reset.
         $this->loggedInUser = FALSE;
         $this->additionalCurlOptions = array();
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
         // Reset the Field API.
         field_cache_clear();
         // Rebuild caches.
         $this->refreshVariables();
         // Reset language.
         $language = $this->originalLanguage;
         if ($this->originalLanguageDefault) {
             $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
         }
         // Close the CURL handler.
         $this->curlClose();
     }
 }
 /**
  * Reset the database prefix and global config.
  */
 protected function tearDown()
 {
     global $user, $language, $settings, $config_directories;
     // Get back to the original connection.
     Database::removeConnection('default');
     Database::renameConnection('simpletest_original_default', 'default');
     // Set the configuration directories back to the originals.
     $config_directories = $this->originalConfigDirectories;
     // Restore the original settings.
     $settings = $this->originalSettings;
     // Restore original shutdown callbacks array to prevent original
     // environment of calling handlers from test run.
     $callbacks =& backdrop_register_shutdown_function();
     $callbacks = $this->originalShutdownCallbacks;
     // Return the user to the original one.
     $user = $this->originalUser;
     backdrop_save_session(TRUE);
     // Ensure that internal logged in variable and cURL options are reset.
     $this->loggedInUser = FALSE;
     $this->additionalCurlOptions = array();
     // Reload module list and implementations to ensure that test module hooks
     // aren't called after tests.
     module_list(TRUE);
     module_implements_reset();
     // Reset the Field API.
     field_cache_clear();
     // Rebuild caches.
     $this->refreshVariables();
     // Reset public files directory.
     $GLOBALS['conf']['file_public_path'] = $this->originalFileDirectory;
     // Reset language.
     $language = $this->originalLanguage;
     if ($this->originalLanguageDefault) {
         $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
     }
     // Close the CURL handler.
     $this->curlClose();
 }
Example #10
0
 public function moveFile($fid, $newcid, &$out_oldcid = NULL)
 {
     global $user;
     $filemoved = FALSE;
     if ($newcid > 0) {
         $query = db_query("SELECT fname,cid,drupal_fid,version,submitter FROM {filedepot_files} WHERE fid=:fid", array('fid' => $fid));
         list($fname, $orginalCid, $dfid, $curVersion, $submitter) = array_values($query->fetchAssoc());
         if ($out_oldcid !== NULL) {
             $out_oldcid = $orginalCid;
         }
         if ($submitter == $user->uid or $this->checkPermission($newcid, 'admin')) {
             if ($newcid !== intval($orginalCid)) {
                 /* Need to move the file */
                 $query2 = db_query("SELECT fname, drupal_fid, version FROM {filedepot_fileversions} WHERE fid=:fid", array('fid' => $fid));
                 while ($A = $query2->fetchAssoc()) {
                     $fname = stripslashes($A['fname']);
                     $sourcefile = $this->root_storage_path . "{$orginalCid}/{$fname}";
                     $private_destination = "private://filedepot/{$newcid}/";
                     // Best to call file_prepare_directory() - even if you believe directory exists
                     file_prepare_directory($private_destination, FILE_CREATE_DIRECTORY);
                     $file = file_load($A['drupal_fid']);
                     $private_uri = $private_destination . $fname;
                     $file = file_move($file, $private_uri, FILE_EXISTS_RENAME);
                     $file->display = 1;
                     list($scheme, $target) = explode('://', $file->uri, 2);
                     $moved_filename = str_replace("filedepot/{$newcid}/", '', $target);
                     if ($moved_filename != $fname) {
                         db_update('filedepot_fileversions')->fields(array('fname' => $moved_filename))->condition('fid', $fid)->condition('version', $A['version'])->execute();
                     }
                     // Remove the attached file from the original folder
                     $source_folder_nid = db_query("SELECT nid FROM {filedepot_categories} WHERE cid=:cid", array(':cid' => $orginalCid))->fetchField();
                     $node = node_load($source_folder_nid);
                     // Remove the moved file now from the source folder
                     foreach ($node->filedepot_folder_file[LANGUAGE_NONE] as $delta => $attachment) {
                         if ($attachment['fid'] == $file->fid) {
                             unset($node->filedepot_folder_file[LANGUAGE_NONE][$delta]);
                             node_save($node);
                             break;
                         }
                     }
                     // Add the moved file to the target folder
                     // Doing node_save changes the file status to permanent in the file_managed table
                     $target_folder_nid = db_query("SELECT nid FROM {filedepot_categories} WHERE cid=:cid", array(':cid' => $newcid))->fetchField();
                     $node = node_load($target_folder_nid);
                     $node->filedepot_folder_file[LANGUAGE_NONE][] = (array) $file;
                     //the name of the field that requires the files
                     node_save($node);
                     // Need to clear the cache as the node will still have the original file name
                     field_cache_clear();
                     db_update('filedepot_files')->fields(array('cid' => $newcid))->condition('fid', $fid)->execute();
                 }
                 $filemoved = TRUE;
             }
         } else {
             watchdog('filedepot', 'User (@user) does not have access to move file(@fid): @name to category: @newcid', array('@user' => $user->name, '@fid' => $fid, '@name' => $fname, '@newcid' => $newcid));
         }
     }
     return $filemoved;
 }
 public static function changeInstances(array $field, array $field_instance_overrides = array())
 {
     $type_info = field_info_field_types($field['type']);
     $instances = field_read_instances(array('field_name' => $field['field_name']));
     foreach ($instances as $instance) {
         $prior_instance = $instance;
         // Serialize properties back into the data property so it can be saved
         // to the database.
         $instance['data'] = array();
         foreach ($instance as $key => $value) {
             switch ($key) {
                 case 'id':
                 case 'field_id':
                 case 'field_name':
                 case 'entity_type':
                 case 'bundle':
                 case 'deleted':
                 case 'data':
                     break;
                 default:
                     $instance['data'][$key] =& $instance[$key];
             }
         }
         $instance['settings'] = array_intersect_key($instance['settings'], $type_info['instance_settings']);
         $instance['settings'] += $type_info['instance_settings'];
         // Validate the existing widget can be used with the new field type.
         $widget_info = field_info_widget_types($instance['widget']['type']);
         if (!in_array($field['type'], $widget_info['field types'])) {
             // Fallback to using the field type's default widget.
             $instance['widget']['type'] = $type_info['default_widget'];
             $widget_info = field_info_widget_types($type_info['default_widget']);
             $instance['widget']['module'] = $widget_info['module'];
             $instance['widget']['settings'] = array_intersect_key($instance['widget']['settings'], $widget_info['settings']);
             $instance['widget']['settings'] += $widget_info['settings'];
         }
         // Validate the existing formatters can be used with the new field type.
         foreach ($instance['display'] as $view_mode => $display) {
             if ($display['type'] !== 'hidden') {
                 $formatter_info = field_info_formatter_types($display['type']);
                 if (!in_array($field['type'], $formatter_info['field types'])) {
                     // Fallback to using the field type's default formatter.
                     $instance['display'][$view_mode]['type'] = $type_info['default_formatter'];
                     $formatter_info = field_info_formatter_types($type_info['default_formatter']);
                     $instance['display'][$view_mode]['module'] = $formatter_info['module'];
                     $instance['display'][$view_mode]['settings'] = array_intersect_key($instance['display'][$view_mode], $formatter_info['settings']);
                     $instance['display'][$view_mode]['settings'] += $formatter_info['settings'];
                 }
             }
         }
         // Allow anything to be overridden before it gets saved.
         $instance = drupal_array_merge_deep($instance, $field_instance_overrides);
         drupal_write_record('field_config_instance', $instance, array('id'));
         // Clear caches.
         field_cache_clear();
         module_invoke_all('field_update_instance', $instance, $prior_instance);
     }
 }
 /**
  * Callback to disable a page.
  */
 function disable_page($js, $input, $item)
 {
     field_cache_clear();
     return $this->set_item_state(TRUE, $js, $input, $item);
 }
Example #13
0
 /**
  * Load objects from the graph
  *
  * @param Context $context
  * @param string[] $pathes
  *   If set, only the matching paths will be loaded
  * @param string $partial
  *   If set, path will be treated as partial match (see the Path class)
  */
 public function loadAll(Context $context, $pathes = null, $partial = false)
 {
     // @todo un-hardcode this
     $loaders = usync_loader_list();
     $list = $this->extractObjects($context, $loaders);
     // Proceed with sorted dependency map, inject all the things!
     foreach ($list as $path) {
         $nodes = (new Path($path))->find($context->getGraph());
         foreach ($nodes as $node) {
             foreach ($loaders as $loader) {
                 if ($loader->canProcess($node)) {
                     $timer = $context->time('load:' . $loader->getType());
                     $this->load($node, $context, $loader);
                     $timer->stop();
                 }
             }
         }
     }
     $context->notify('load:finished');
     /*
             if (null !== $pathes) {
      $visitor->addProcessor(function (NodeInterface $node, Context $context) use ($drupalProcessor, $pathes, $partial) {
        foreach ($pathes as $pattern) {
          if (false !== Path::match($node->getPath(), $pattern, $partial)) {
            $drupalProcessor->execute($node, $context);
          }
        }
      });
             } else {
      $visitor->addProcessor($drupalProcessor);
             }
     */
     // @todo move this out ot a listener
     // This seems, at some point, mandatory.
     field_cache_clear();
     // DO NOT EVER call menu_rebuild() manually, if you do this, Drupal will
     // mix-up the menu links you manually saved using menu_link_save() and
     // those still in cache at some point, and loose menu items parenting.
     // This wrong behavior cost me a few hours to debug.
     variable_set('menu_rebuild_needed', 1);
 }