/**
  * {@inheritdoc}
  */
 public function synchronize(NodeInterface $node, Context $context, $dirtyAllowed = false)
 {
     /* @var $node \USync\AST\Drupal\MenuNode */
     $object = ['menu_name' => $node->getName()];
     if ($node->hasChild('name')) {
         $object['title'] = (string) $node->getChild('name')->getValue();
     }
     if ($node->hasChild('description')) {
         $object['description'] = (string) $node->getChild('description')->getValue();
     }
     $object += self::$defaults;
     if ($node->shouldDropOnUpdate()) {
         $context->log(sprintf("%s: deleting menu and children", $node->getPath()));
         menu_delete($object);
     }
     menu_save($object);
     return $node->getName();
 }
 case 'deleteelement':
     deleteElement($cid, $option);
     break;
     ///// menu tools
 ///// menu tools
 case 'menu_creator':
     menu_creator($option);
     break;
 case 'menu_remover':
     menu_remover($option);
     break;
 case 'menu_save':
     menu_save($option);
     break;
 case 'menu_delete':
     menu_delete($cid, $option);
     break;
     ///////////////
 ///////////////
 default:
     global $mainframe;
     $database =& JFactory::getDBO();
     $switch = 1;
     if (strpos("x" . $task, "plugin_")) {
         $directory = JPATH_SITE . '/components/com_chronocontact/plugins/';
         $results = array();
         $handler = opendir($directory);
         while ($file = readdir($handler)) {
             if ($file != '.' && $file != '..' && substr($file, -4) == '.php' && substr($file, 0, 3) == 'cf_') {
                 $results[] = str_replace(".php", "", $file);
             }
 /**
  * Reinitialize some Community environment settings.
  *
  * @AfterFeature @cleanCommunityEnvironment
  */
 public static function cleanCommunityEnvironment()
 {
     // Delete 'community' node type.
     _node_types_build(TRUE);
     node_type_delete('community');
     field_purge_batch(1);
     // Delete community's variables.
     $feature = features_load_feature('nexteuropa_communities');
     if (isset($feature->info['features']['variable'])) {
         foreach ($feature->info['features']['variable'] as $varname) {
             variable_del($varname);
         }
     }
     // Delete community's menu_links.
     if (isset($feature->info['features']['menu_links'])) {
         foreach ($feature->info['features']['menu_links'] as $menulinks) {
             menu_link_delete(NULL, $menulinks);
         }
     }
     // Delete community's menu_custom.
     if (isset($feature->info['features']['menu_custom'])) {
         foreach ($feature->info['features']['menu_custom'] as $menucustom) {
             $menu = menu_load($menucustom);
             menu_delete($menu);
         }
     }
     drupal_flush_all_caches();
 }