function css_injector_update_7202 in CSS Injector 7.2
Add the new fields to the css_injector_rule table
File
- ./
css_injector.install, line 169 - css_injector.install
Code
function css_injector_update_7202(&$sandbox) {
// add field so schema supports
// 1.x
// crid
// title
// rule_type
// rule_conditions
// rule_themes
// media
// preprocess
// enabled
//
// 2.x
// crid
// name
// admin_description
// css
// media
// preprocess
// inline
// page_visibility
// page_visibility_pages
//
// //changes
// title -> name (in previous hook)
// add css
// rule_conditions -> page_visibility and page_visibility_pages?
//
// //what to do with
// rule_type?
// rule_themes?
$fields = array(
'admin_description' => array(
'type' => 'varchar',
'length' => '255',
'description' => 'A human readable name of a rule.',
),
'css' => array(
'type' => 'text',
'size' => 'big',
'description' => 'The actual code.',
),
'inline' => array(
'description' => 'Boolean indicating whether the rules should be inline (cannot be aggregated).',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'page_visibility' => array(
'description' => 'Boolean indicating whether the rule has a white or black list for page visibility.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'page_visibility_pages' => array(
'type' => 'text',
'size' => 'big',
'description' => 'A list of pages to either hide or show the CSS.',
),
);
foreach ($fields as $key => $field) {
if (!db_field_exists('css_injector_rule', $key)) {
db_add_field('css_injector_rule', $key, $field);
}
}
}