Edit Another Page's Areas

Permalink
Is it possible to render and edit another page's areas on a different page.

Basically alias an area...

For example, say I have the page "Contact Us" with the area "Main", and I want this area to be displayed on multiple pages.

That's simple enough...
$add = Area::get(Page::getByPath('someplace/contact_us'), 'Main');
if(is_object($add)) {
   $add->display($p);
}
What I would like to happen is to be able to click Edit Page on any page that has the area alias and edit the aliased area.

Is this possible?

ijessup
 
Mnkras replied on at Permalink Reply
Mnkras
so like global areas?
jordanlev replied on at Permalink Reply
jordanlev
I tried to get something like this working for my "global areas" concept (seehttp://www.concrete5.org/community/forums/usage/a-new-approach-to-a... )

But I don't think it's possible. Even if it were, I realized that there's a problem that would come up with page versions -- if you edit one page and change an area that's on a different page, where does the change version live -- in the current page or in the other page?

While it's not ideal, I think a workaround solution to your problem might be to add some code to your page type template that outputs a link to the page that the area is coming from IF the page is in edit mode. (The link could have some text like "To edit this area, click here").

BTW, if you do ever figure out how to do this "the real way", please let me know as I'd be very interested in finding out!
ijessup replied on at Permalink Reply
ijessup
@Mnkras: Not necessarily global.

@jordanlev: Long but interesting read for sure.

I want to edit another page's area. As in, the area is stored in the page version that the area belongs to, but is editable on a page that is not the area's "owner".

Note: I was unaware area's were stored based on their "owner" rather than an AreaID or something of that nature. I'm not as versed on this topic as I'd hope, so treat me as ignorant regarding areas.

I ask this because I'm working on a different, and hopefully refreshing, UI concept for navigating a site.

Reference:http://jessupwebdesign.com

Each area being displayed (other than the first one you see) is from each child page, but is uneditable when the parent page is in edit mode.
jordanlev replied on at Permalink Reply
jordanlev
Yeah, I saw this from another post the other day -- it's *really* cool!

To clarify my point about page versions -- think about how this would work exactly... You're on the home page, which is showing these aliased areas that live on another page (let's call it "Contact Page" for this example). You click edit on the home page, and somehow you're able to edit that area which actually lives on the "Contact Page". Now you click "Exit Edit Mode" and get asked to enter version comments, and publish or preview. Well, where do those version comments go? I guess it could go to BOTH the home page and the aliased "Contact Page"? What about Preview mode -- does it put just the home page in preview mode or the aliased page as well? And what if you go and publish the changes on the aliased page -- now does the home page get published as well or is it still stuck in preview mode?

I'm not saying that this is a reason to avoid doing what you're trying to do (because I think having that would be incredible -- the Page Defaults and Global Scrapbook just don't cut it for many situations), but I think this is why it's impossible given the current system architecture.

But I could be wrong -- I wonder if someone from the core team could pipe in on this?
Mnkras replied on at Permalink Reply
Mnkras
havn't looked at the docs yet, but maybe,

get an array of block ids then display the blocks,
ijessup replied on at Permalink Reply
ijessup
I may be misunderstanding you, but displaying isn't the hard part. It's editing them.

...but you may be on to something.
ijessup replied on at Permalink Reply
ijessup
Very good point about the preview mode, hadn't even dawned on me.

I guess I was assuming there were area version or that areas were an independent item.

I will likely arrive to your same conclusion, but I see now that I need to dive into the code and look at how Areas relate to Collection Versions.
ijessup replied on at Permalink Reply
ijessup
If one of the child pages is checked out (by me), the area controls will show up on the parent page, but are unusable. Likely because the JS hasn't been loaded when viewing the parent page. Unfortunately, if you try to edit the parent page, this force checks-in any other checked-out page you were working on.

I'll look into this further.