Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Populate Page Metadata Schema on selection of Page Template

In Tridion 2011 - What is the best ways to achieve the below: On creation of the new page of editing the existing page, when the editor selects a page template, can we automatically set the associated Page Metadata Schema to it. So basically define a one to one association of a PT and Metadata schema as utilize it.

like image 495
Rohan Gadiya Avatar asked Dec 10 '12 18:12

Rohan Gadiya


1 Answers

I can see these options:

  1. an event handler, see the docs here (log in required)
  2. a data extender, see the docs here (log in required)
  3. a client-side GUI extension

Each of these extension points has also been covered in previous questions here in StackOverflow and in external blog posts. Those might serve as good additional "documentation" on what is possible/feasible with each of them.

All of these have their own advantages and disadvantages. Which one is best for you really depends on your exact requirements, the willingness you have to educate your users a bit and the skill set of the developers that end up implement and maintaining it.

Event handlers and data extenders run on the server and are written in C#, which means they are typically a bit easier to develop and debug. Client-side GUI extensions give you the fullest control over the user interface, but that control comes at a price: they have a higher learning curve for most developers.

Update To respond to changing of the Page Template in the GUI, you can use something like this:

var c = $display.getView().properties.controls;
$evt.addEventHandler(c.PageTemplate, 'change', function() { 
  console.log(c.PageTemplate.getValue()); // the newly selected Page Template
  c.MetaSchemaDropdown.setValue('tcm:10-2103-8'); // the corresponding Metadata Schema
});
like image 93
Frank van Puffelen Avatar answered Oct 01 '22 03:10

Frank van Puffelen