function flexiform_update_7009 in Flexiform 7
Add displays field to the flexiform table.
File
- ./
flexiform.install, line 471 - Sets up the base table for our entity and a table to store information about the entity types.
Code
function flexiform_update_7009() {
db_add_field('flexiform', 'displays', array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of displays of this flexiform.',
));
$rows = db_select('flexiform', 'f')
->fields('f', array(
'form',
'path',
'edit_path',
))
->execute()
->fetchAllAssoc('form');
foreach (entity_load('flexiform') as $form) {
$row = $rows[$form->form];
if (!empty($row->path)) {
$form->displays['flexiform_create_entity_page'] = array(
'enabled' => TRUE,
'title' => $form->label,
'path' => $row->path,
);
}
if (!empty($row->edit_path)) {
$form->displays['flexiform_edit_entity_page'] = array(
'enabled' => TRUE,
'title' => $form->label,
'path' => $row->edit_path,
);
}
$form
->save();
}
db_drop_field('flexiform', 'path');
db_drop_field('flexiform', 'edit_path');
}