Fix for Fix for Fix for QueryPath for removing an XML item

  1. function mymodule_update_languages_xml($form, &$form_state) {
  2.     /*
  3.     ...
  4.     */
  5.     $qp = qp($file);
  6.     if ($form_state['values']['op'] == 'Delete') {
  7.       // Find only items that have id=$language, e.g. id="en-US'
  8.       $qp->find('languageList>item[id=' . $language . ']')->remove();
  9.     }
  10.     /*
  11.     ...
  12.     */
  13. }
  14.  
  15.  
  16. // the relevant portion of the xml file...
  17.         <languageList default="en-US">
  18.  
  19.                 <item id="en-US" title="language_en-US"/>
  20.                 <item id="es" title="language_es"/>
  21.  
  22.         </languageList>

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.