jah

template set plugin perl package and the widgetset template type

Vote 0 Votes

Greetings!

I've been designing a template set on a development installation of mt and I've almost successfully packaged it up ready for deployment to the live website.

I've created a perl package for the plugin based on the one used in the Mid-Century template set and it works lovely except for the widgetsets. Upon refreshing templates, all of the template types are created including the widgets and widgetsets, but the latter are not populated with the desired widgets - no widgets in them at all.

I haven't been able to find an example of defining widgetsets in a package so I've posted my attempt below in the hope that some bright spark will spot the error:

widget => {
    'category_nav' => {
        label => 'Category Nav',
    },
    'monthly_nav' => {
        label => 'Monthly Nav',
    },
    'mytweets' => {
        label => 'mytweets',
    },
    'reader' => {
        label => 'reader',
    },
},
widgetset => {
    'archive_links' => {
        order => 1000,
        label => 'Archive Links',
        widget => {
            'category_nav',
            'monthly_nav',
        },
    },
    'social' => {
        order => 1000,
        label => 'social',
        widget => {
            'mytweets',
            'reader',
        },
    },
},

Reported on Movable Type 4.3

5 Replies

| Add a Reply
  • It's probably just a minor syntax glitch. The Professional template set(its definition is in YAML but the structures translate) defines widgets plural under the widgetset. Try that.

  • Thanks Su. I tried the plural widgets under widgetset and got an error whilst refreshing the template:

    Not an ARRAY reference

    I too had looked at the YAML definition (which as you say should translate) which I found in the source for Vanilla+Widgets, but no dice there - I'll keep trying stuff, I'm sure I'll get it in the end...

  • The clue was in the error message and you were right Su - it is the plural widgets and if it's defined as an array, rather than the hash that I defined it as, then it works properly.

    One thing I found was that widgets must be an array of widget labels and not simply the names:

    widget => {
        'category_nav' => {
            label => 'Category Nav',
        },
        'monthly_nav' => {
            label => 'Monthly Nav',
        },
        'mytweets' => {
            label => 'mytweets',
        },
        'reader' => {
            label => 'reader',
        },
    },
    widgetset => {
        'archive_links' => {
            order => 1000,
            label => 'Archive Links',
            widgets => [
                'Category Nav',
                'Monthly Nav',
            ],
        },
        'social' => {
            order => 1000,
            label => 'social',
            widgets => [
                'mytweets',
                'reader',
            ],
        },
    },
    

    Thanks for your help.

  • Hugo Systems

    Hi Jah,

    I tried to do it the way you explained but no luck for me

    widget => {
    'news' => {
    label => 'News',
    },
    'search' => {
    label => 'Search',
    },
    },
    wigetset => {
    '2_column_layout_sidebar' => {
    order => 1000,
    label => '2-column layout - Sidebar',
    widgets => [
    'Search',
    'News',
    ],
    },
    },

    Any specific thing which I missed here? I have defined everything under "registry->templatesets" as it usually done in the YAML.

    I would appreciate any help please.

    Thanks.

  • I can't see anything wrong with the syntax - just the typo in the word widgetset (you missed a 'd'). Does the template set work other than adding widgets to the widgetset?

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012