Custom region does not show up in a Drupal Sub theme - drupal-7

I am attempting to create a custom region for my Drupal 7 sub theme. The process I am following is:
1) Specify sub region in .info file of subtheme like this:
regions['sub_region'] = Sub region
2) In the page.tpl.php file,
print render($page['sub_region']); at the location where I wish the sub region would appear.
3) Cleared the Cache
However, this new sub region does not appear in my Blocks.
Anybody have pointers as to what I am doing wrong ? Or need to do more
Thanks

Your syntax for the region declaration in .info is incorrect. There should not be single quotes wrapping the region name.
regions[sub_region] = Sub region
Documentation for .info file

It might be worth having a read of this, specially this section.
Region inheritance
Sub-themes do not inherit custom regions from a parent theme. If you
are using custom regions, you should copy the region declarations from
the parent theme's .info file. Be sure your sub-theme's page.tpl.php
file matches the sub-theme's region settings.
EDIT
On your blocks page in the top right corner are tabs so you can set different blocks on different themes. Are you selecting the sub theme?

Related

Add content area within custom class property in Episerver

I am creating a custom class with the below given definition.
One of the property type given below is of type content area(Media).
Issue: Since this custom property is in a popup itself, when clicking on the create new block in media content area, it opens the list of blocks to be added behind this popup as shown in the image below(carousal block)
Because of this ,I am unable to add the block within the content area.
.Is there a way to handle this wherein I can add the block within this custom class?
Any help is appreciated.
A bit late to the party here but will go ahead and answer it anyway for anyone else in the future who might encounter the same problem. So one option is to go with what Ted Nyberg suggested which will in the end probably provide a cleaner user experience. This is however a bit more advanced approach necessary due to a limitation in the product.
Another approach is to create a block instead of your custom class. This will provide the proper editor experience when working with the content area and will be faster to implement if you have no or little experience with adding custom css to the edit ui.
This goes for CMS versions < 12 and I can't say if this is still a problem in version 12 or not.

How do I define the size and location of a pop up sub VI when calling it in my main program?

I have a main program which calls several sub VIs. Each sub VI has either a button, or timer or something which the operator must view or interact with while still monitoring the main front panel. How do I define the size and location of each sub VI as it pops up when called?
In the image below I have my main front panel with my gauges, etc and I have the sub VI in the location and of the size I require. How do I ensure that each time the sub VI is called it pops up here?
Figured out that in the sub VI you can control the properties by going to Tools -> Properties and then changing the tab to select window size and appearance.
What about moving such controls into the Main VI Front Panel ? It may look better in overall than pop up windows just to launch the application.
Also you can use tabs if there is lack of space on your Front Panel.
I would suggest using subpanels. You can use them to display the panels of subVIs at specific positions in the main VI. You can use Static VI references to reference the specific subVIs.
If for some reason you don't want this, you can also control the position dynamically, not just statically. You will need to use property nodes for that and set the VI's FP window bounds property.

How to enable on-page editing blue borders for blocks in other languages

I have a multilingual site in EpiServer 7.
I have a block.
This block has some culture specific properties.
The block is only on-page editable in the language that it was created on.
Why aren't the borders showing up in the other languages and how to enable them?
Are you using a ContentArea or a local block (i.e. a strongly typed property of the block type)?
Either way it should work if you use the [CultureSpecific(true)] attribute on the Content Area or block property.

WPF fail. Using a WPF page as an instance

Think about a WPF program that has 2 pages which you navigate between. (Upload and Crop)
In the first page, you load an image using a button, select the image, and your image appears in the WPF Image control. Then, you press the "Crop" button. That sends the navigation to the second page, which you can crop the image.
Then, you crop the image in the second page. Then you press "next". Next button must redirect you to the first page, but wait a minute, the image you loaded no longer exist in the page. Because it's a new page.
Dim CropPage As New Crop(Crop_Bmp, Crop_BmpSource)
Me.NavigationService.Navigate(CropPage)
You may think it's okay. Because we pass the parameters and we can refill the WPF Image controls using that parameters. But, there is actually 8 upload panels in the page 1. So, other ones are important.
Or think about another method I found. Instead of using a new page instance, navigate back that you used.
Upload.Crop_Bmp = Crop_Bmp
Upload.Crop_BmpSource = Crop_BmpSource
Me.NavigationService.GoBack()
Upload.Crop()
But in the second one, it throws errors.
"Reference to a non-shared member requires an object reference."
Then, back to the Upload page, I made the variables and functions "Shared". But then, more problems come up. Because you cannot edit the local variables unless you also make them Shared. So, all of the variables and functions need to be "Shared".
I'm searching about a solution for a few days and I could not get rid of them. What method should I use? Redirecting back, or opening a new instance?
In old-type applications, it was very easy. All was that:
Form1.Crop_Bmp = Crop_Bmp
Me.Hide()
Form1.Crop()
And it was working perfectly. Because the forms were not instances like WPF pages. That's the reason I find WPF quite weird.
I found it a way to do this. When navigating to the Crop page, I sent the Upload page as a parameter to Crop Page.
Dim CropPage As New Crop(Crop_Bmp, Crop_BmpSource, Me)
Me.NavigationService.Navigate(CropPage)
Then, in Crop:
Public Sub New(ByVal Crop_Bitmap_ As Bitmap, ByVal Crop_BitmapSource_ As BitmapSource, ByVal pg As Upload)
' This call is required by the designer.
InitializeComponent()
UploadPage = pg
Then, in the Crop page, I accessed that parameter to modify its elements. For example:
Me.NavigationService.Navigate(UploadPage)
UploadPage.Crop()
This sounds like a bad use-case for the Pages metaphor. Pages are for loosely coupled peer screens (E.G. A separate page for each department), but you are using them in a tightly coupled parent-child relationship. (The "Crop" page is the child of the "Upload" page) For what you are doing, launching the crop screen as modal dialog might be more fitting.
If you want to keep everything in the same window, you can keep both functions in the same window, and toggle their visibility as needed.

WPF Prism - To use Scoped Regions or not?

I have a WPF project based upon Prism Feb 2009 release set up as:
Shell exposes a single ContentControl as "MainRegion"
Another view (user control) defined in the Infrastructure project called SplitView exposes two additional regions "LeftRegion" and "RightRegion" also as ContentControl.
Some of my application's modules need to display their view in the MainRegion (one user control), while others need to display their views (two user controls in a split fashion) in the LeftRegion and RightRegion.
I have tried using scoped regions, assuming that specific Controllers would hold references to the scoped regions. So basically each controller interested in SplitView functionality should instantiate a new SplitView (user control) and activate it in the MainRegion while activating its two user controls in the LeftRegion and RightRegion of the newly created scoped SplitView regions.
I am using MVVM with View Injection to display the views.
Needless to say, something has gone horrifically wrong with this approach.
At runtime I get this exception, "An exception occurred while creating a region with name 'LeftRegion'. The exception was: System.InvalidOperationException: Specified element is already the logical child of another element. Disconnect it first."
Am I correct at assuming that the LeftRegion and RightRegion are trying to register themselves with the main RegionManager every time I instantiate the SplitView?
Sorry about the confusing/verbose post. Any suggestions? Best practices to achieve this?
Thanks in advance,
Ali
The exception of "Specified element is already the logical child..." is what happens when you try to add something to two places in the tree, so I imagine there might be some logical error in your code, or you are adding something twice.
I generally create my sub regions like this:
m_scopedRegionName = Guid.NewGuid().ToString(); /* EXAMPLE ! */
m_scopedRegionManager = m_regionManager.Regions[RegionNames.WORKSPACE_REGION].Add(myViewModel.View, m_scopedRegionName, true);
m_someThingRegion = m_scopedRegionManager.Regions[RegionNames.SOME_THING_REGION];
Then I add any new stuff into the "m_someThingRegion".

Resources