Based on a condition, i need to move items(Components/Pages) from current publication to a specified publication.
Could anyone suggest me the approach regarding this.
Thanks in Advance.
Moving items across Publications is unfortunately not supported by the UI and also not directly by the API. But there are still two possibilities you have to accomplish this.
use Content Porter to export your items and import them in the Publication you need them. You can change the mapping of the Publication as described in the Content Porter documentation, or what I usually do is just rename the Publication you want your items to go in, to the same name as where the items came from (you will have to temporarily change the name of the original Publication and after the import you can change everything back again).
use the API to create a new item in the Publication of your choice and copy the contents of your item to move in there. Once that is done you can use the API to delete your original item. Depending on your BluePrinting scenario in this move action, you might need to rename your original item before you can create the new one to prevent naming conflicts (in case you are moving it up the BluePrint hierarchy).
The only downside to each of these two possibilities is that your items will get a new URI. It is not possible to keep the existing URI of your items when you need to move them across Publications. This also means that you might have to update all items using the original ones, so that they are using your new items instead. If this is required, you are most likely looking at the second option.
Related
Is there any way to have multiple instances of a store?
I am actually trying to fill a grid layout with thumbnails (which contain buttons and other stuff).
I want to outsource the items in a separate component, using its own instance of the same store.
I don't know if that's even a good solution. It's the only one i came up with so far.
Anyone has a better idea how to solve this?
What is important to me, is that each thumbnail is loaded when its component is rendered. While it is loading it should display a loading spinner.
It's not a good approach. The purpose of the state is to exist once and be available to all.
What you need is state that holds a collection of FileState (or whatever you want to call it) which has all the info it needs, including bool IsLoading.
I am aware of the Inner-Content/Content-Blocks stuff you have made available via Content-Type setup of a WYSYWIG and related fields. However, what I am looking for is much simpler, seems possible, but for some reason I am not finding it based on how I have searched so far. Let's say I am already in a View outputting my Content-Type, a "Destination" which ties together Basic Content, Image(s), and a Location. I have a field in the Destinations content-type that is a simple 1:1 to an Entity Location. And yes, I am working in the Content-App. The custom Location View already exists to output the linked Entity by itself. Easy to just add another Content module to the page, but we don't want to do that. What I am looking for is to output that whole View for that one linked Location Entity with a single line of code. Does this exist? I could probably use RenderPage() and pass in my Entity and rewrite the existing View to dynamically handle the passed in Entity (or default to Content as it is now).
So to rephrase, is there a function, API call, that lets me...
#...ContentBlocks.Render.View(contentEntityId, viewEntityId);
Some background
The ContentBlocks.Render requires a lot of information to work, because it also does a lot behind the scenes. So internally a content-block is a special entity which points to an app-id, a template-id and (zero, one or many) content items. So it's basically a module-definition (each module points to a content-block).
What you need
Since your entity is only the data, it can't know how it should be displayed without you specifying the template. So RenderPage is the way to go. I recommend you do this:
a sub-view which contains the whole logic and can only be used from RenderPage
call it from this view
and also call it from the other view, which contained the original work
This is better than a template which does some kind of automatic fall back, because as time goes on, people forget that it has 2 purposes, and will make changes and only test one scenario, breaking the other.
Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog
I'm looking for the way for the site's administrator / moderator to find / filter the list of nodes by some field custom value. Field value could be defined by radio / text / checkbox etc.
Default content listing proposes only few filters, it's not enough for sites with huge amount of custom nodes.
Use an EntityFieldQuery object, documented here:
http://api.drupal.org/api/drupal/includes--entity.inc/class/EntityFieldQuery/7
The documentation has no examples (ugh), but there's a thread here with some:
http://drupal.org/node/916776
EDIT: Ah, you're talking about administration and not actually writing a module to do it. If that's the case, use a view with exposed filters, like the other guy said. :)
Maybe it would help to use a view for it, where you set filters, so that you get the desired listing.
I had to test this, but I've just confirmed. Views in Drupal 7 can indeed filter across multiple content types w/ custom fields, and still have filters apply to those custom fields. They seem to treat the nodes w/o those custom fields as empty or null values.
So for instance, I have article and blog content types. Blog has images, article does not. I can sort or filter on the image field, even though article doesn't have it. It simply assumes the field is null or empty.
This however, may not solve your problem of having a large number of custom fields. If these are dynamic (i.e. they grow over time) you might be in trouble. If, however, they are set, and just a very large number, you could manage this.
So while there is no automatic add all fields, which I believe you mentioned in a previous post, you could feasibly search on a large variety of the fields. Even exposing fields that you don't necessarily display in the table, but can then search on. Or changing the fields you expose or display on a per page basis in the view. All from one view. And then you could export the view to bring it over to the other sites.
I was going to try and attach the exported view, but the export is rather large for inclusion in an answer, I think. Please let me know if you think I should still include it, or if you'd rather I can simply send it to you through a PM. Let me know!
EDIT: I decided to include a link to an export of the view. http://greggalante.com/sites/greggalante.com/files/cross_type_view.txt
http://drupal.org/project/search_api
I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.