On Apr 26, 2007, at 04:14, Scott Lanning wrote:
> OK, thanks. I was looking in some Callback and it
wasn't making sense;
> I imagine the SOAP stuff exercises most of the
functionality.
Right.
> I'm trying to upgrade our templates... It's just hard
> juggling "ok, that was assettype now elementtype
and
> no more separate element and elementtype and
...."
> At least for me.
They *should* be largely backward compatible. You shouldn't
have to
do much to get your templates working, though you likely
could do a
lot to update them to use the improved API.
> I guess what I need is a mapping
> from old to new. As far as I can see:
>
> 1.8:
> my $element = Bric::Biz::AssetType->lookup({id
=> $element_id});
> 1.10:
> my $element = Bric::Biz::ElementType->lookup({id
=> $element_id});
Yes, though you might want to rename the variable.
> $element->is_active, $element->get_top_level work
the same..
> get_output_channels. get_containers.
Yep.
> 1.8:
> foreach my $data ($element->get_data) {
> my $meta = $data->get_meta('html_info');
> 1.10:
> foreach my $data ($element->get_field_types) {
Yes, more or less. Take a look at the bricolage.cc template
that
generates these:
http://www.
bricolage.cc/about/doc_models/
Especially if you compare it to earlier versions (avialble
in earlier
bricolage.cc template tarballs, which are on the downloads
page.
> The $data in 1.10 basically encompasses the old $data
> plus the old $meta. We have these replacements
(otherwise the same):
>
> 1.8 === 1.10
> type => $meta-> === ???
What that "text" or "textarea" or
whatever? That's now in $field_type-
>widget_type.
> label => $meta-> === name =>
$data->get_name
> default => $meta-> === default_val =>
$data->get_default_val
> options => $meta-> === =>
$data->get_vals
> multiple => $meta-> === =>
$data->get_multiple
> size => $meta-> === length =>
$data->get_length
> rows => $meta-> === =>
$data->get_rows
> cols => $meta-> === =>
$data->get_rows
Yep, those look right.
> And for setters, it's similar, 1.8 had some things
> like $data->set_key_name, $data->set_required,
$data->set_quantifier,
> etc., but also the meta crap:
> $data->set_attr(html_info => disp =>
$field->);
> etc., which led to (I think) Sam's "my eyes are
burning!" comments.
Yes. No more burning eyes.
> I'll put this in the wiki, probably only for my own
reference.
I'm sure others will find it useful, too.
Best,
David
|