Guest User

Untitled

a guest
Jan 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Implements hook_install.
  4.  */
  5. function test_install() {
  6.   //Deleting the appropriate info out of the 'filter' table.
  7.   //TABLE_NAME is the name of the table in the db you are working with.
  8.   //COLUMN_NAME is the name of the column or field inside of the table you are
  9.   //looking in.
  10.   //VALUE is what is in the field you are looking for.
  11.   /**
  12.    * db_delete('TABLE_NAME')
  13.    *  ->condition('COLUMN_NAME', 'VALUE')
  14.    *  ->execute().
  15.    */
  16.   db_delete('filter')
  17.     ->condition('format', 'filtered_html')
  18.     ->condition('module', 'filter')
  19.     ->execute();
  20.  
  21.   /**
  22.    * db_insert('TABLE_NAME')
  23.    * ->fields(array(
  24.    * 'column1' => 'desired_input1'
  25.    * 'column2' => 'desired_input2'
  26.    * ));
  27.    */
  28.   db_insert('filter')
  29.     ->fields(array(
  30.       'format' => 'filtered_html',
  31.       'module' => 'image_resize_filter',
  32.       'name' => 'image_resize_filter',
  33.       'weight' => '-10',
  34.       'status' => '1',
  35.     ))
  36.   ->execute();
  37.   db_insert('filter')
  38.     ->fields(array(
  39.       'format' => 'filtered_html',
  40.       'module' => 'htmlpurifier',
  41.       'name' => 'htmlpurifier_advanced',
  42.       'weight' => '-9',
  43.       'status' => '1',
  44.     ))
  45.   ->execute();    
  46. }
Add Comment
Please, Sign In to add comment