-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import a view from Drupal 7 #77
Comments
There is no built-in way to do this. Although I wouldn't completely recommend this, you could probably do the following. (Note, I haven't actually tested this.)
// Paste in view export here. Which defines the $view variable.
print json_encode($view);
This would also make an excellent contrib module. 😉 But in general, the configuration of a view in D7 is identical to Backdrop. You could also look at views_update_1001() for reference to see how the upgrade was done. |
Thanks @quicksketch . I will give it a try. I need it for the port of contrib Twitter. |
Oh! Well another option if this is a one-time thing:
Now all the Twitter views are converted to JSON config files. |
Longer term I want to move to Backdrop a Drupal 7 site that has several custom views. Will this update procedure also be good for that? |
Yes! Definitely. Backdrop's update.php can update just about anything that is in the database to config files, including content types, menus, views, vocabularies, fields, image styles, etc. The only problem is that some things are stored in code in D7 and not in the database at all (like default views and image styles). So before you upgrade a site, you have to get everything back into the database (oh the irony) before you run update.php to upgrade to Backdrop. If you've used Features in the past, https://www.drupal.org/project/unfeaturize might come in handy for this purpose. 😄 |
Hi @quicksketch - I have successfully imported the view of tweets into the contrib module Twitter for backdrop, but the block option within the view is not appearing in the list of blocks within Backdrop. What else do I need to do? (The page view works fine). I used your suggestion of making a D7 site and then updating that to Backdrop. It produced one alarming error report but I pressed on to try update.php and everything went well, producing the necessary config file. |
Hm, maybe edit the view and check to make sure that the "Block" display is set up correct and that the preview works within Views. It might not hurt to change a simple option and then re-save the view just to make sure everything is set up correctly in the config file. |
I was misunderstanding things and expecting the block view to be listed at admin structure : custom blocks : list blocks. But it is not there and shows up OK when going to Edit layout : Add block However, having done this and setting that it should appear on a test page, it is not rendering correctly, so I shall investigate further, perhaps trying by creating and using a different view block. The content is showing correctly within Views preview. From: Nate Haug [mailto:[email protected]] Hm, maybe edit the view and check to make sure that the "Block" display is set up correct and that the preview works within Views. It might not hurt to change a simple option and then re-save the view just to make sure everything is set up correctly in the config file. — |
A few more tests show that my views block listing tweets is there in the system and will show correctly in certain conditions. But I am seeing something very odd happening with layouts, and interaction between blocks. At first sight it seems that blocks generated by views interact with the main page content block, causing the latter to do strange things. I must try testing more combinations. |
We have an issue for displaying a list of available blocks at backdrop/backdrop-issues#449. |
I'm not getting this. I want to convert the contents of a hook_views_default_views() to json. Can you please explain simply again how to do this? |
Is there an automated way to import a view from Drupal 7 and create the json file needed by Backdrop?
The text was updated successfully, but these errors were encountered: