require_once dirname(__FILE__) . '/class/yams.class.inc.php';
require_once dirname(__FILE__) . '/yams.module.funcs.inc.php';
$yams = YAMS::GetInstance();
$activeTemplateList = $yams->GetActiveTemplatesList();
$hideFields = $yams->GetHideFields();
$useMultilingualAliases = $yams->GetUseMultilingualAliases();
$encodingModifier = $yams->GetEncodingModifier();
$langIds = array_merge($yams->GetActiveLangIds(), $yams->GetInactiveLangIds());
//// yamsRoles is an array mapping which applies roles to each language
//if ( ! is_array( $yamsLanguageRoleMap ) )
//{
//  $yamsLanguageRoleMap = array();
//}
//
if ($activeTemplateList != '') {
    mm_renameField('pagetitle', 'Internal Name', '', $activeTemplateList, 'This field is used to identify the document (and its language variants) within the document tree of the MODx Manager. It will not appear anywhere on the document itself.');
    if ($hideFields) {
        // Don't hide the pagetitle because it is used within the modx document tree
        // to identify the page
        mm_hideFields('longtitle,description,introtext,menutitle,content', '', $activeTemplateList);
        mm_hideSections('content', '', $activeTemplateList);
        if ($useMultilingualAliases) {
            mm_hideFields('alias', '', $activeTemplateList);
        } else {
            $aliasesToHideArray = array();
            foreach ($langIds as $langId) {
                $aliasesToHideArray[] = YAMSTVDataToMMName('alias_' . $langId, $id, 'tv', $mm_version);
            }
            if (count($aliasesToHideArray) > 0) {
                $aliasesToHide = implode(',', $aliasesToHideArray);
                mm_hideFields($aliasesToHide, '', $activeTemplateList);
mm_renameField('longtitle', 'Headline', $news_role, '', 'This will be displayed at the top of each page');
// We'd like to treat our news stories differently from other documents, so let's customise them. They use a specific
// template (ID 10) so let's set a variable with this ID in.
$news_tpl = '10';
// We categorise our news stories with a TV (news_category), so let's put this on a new tab to make it obvious to editors
mm_createTab('Categories', 'cats', '', $news_tpl, '', '600');
mm_moveFieldsToTab('news_category', 'cats', '', $news_tpl);
// Some of our field names could be clarified for news stories...
mm_changeFieldHelp('longtitle', 'The story\'s headline', '', $news_tpl);
mm_changeFieldHelp('introtext', 'A short summary of the story', '', $news_tpl);
// We don't need to show these, as news stories aren't shown in menus
mm_hideFields('menuindex,show_in_menu', '', $news_tpl);
// Always make the page, menu and long titles the same
mm_synch_fields('pagetitle,menutitle,longtitle', '', $news_tpl);
// Set some defaults for everyone
// Always set the default publication date to today
mm_default('pub_date');
// Change the introtext field name to something more plain English
mm_renameField('introtext', 'Summary');
// and do the same for some of the help messages
mm_changeFieldHelp('alias', 'The URL that will be used to reach this story. Only numbers, letters and hyphens can be used');
// Add some widgets to certain TVs
mm_widget_tags('blogTags');
// Give blog tag editing capabilities to the 'blogTags' TV
mm_widget_colors('colour', '#666666');
// make a color selector widget for the 'colour' TV
mm_widget_showimagetvs();
// Always give a preview of Image TVs
// For everyone except administrators - this field doesn't mean much to anyone else
mm_hideFields('link_attributes', '!1');
// ------------------------ END OF RULES --------------------
Example #3
0
<?php

// MM rules can go in here, instead of a chunk.
// If you want to put your rules in a chunk, create one and specify its name in the plugin's configuration tab
// If you copy them to a chunk, don't include the opening and closing PHP tags
// ------------------------ INSERT YOUR RULES HERE --------------------
// Insert your rules here. You can also use a chunk; see the plugin configuration and documentation.
// For example rules, also see the default.mm_rules.inc.php and the documentation. PHP is allowed.
// Hide templates for non admin users
mm_hideTemplates('6', '!1');
// Make news stories published on today's date by default
mm_default('pub_date', '', '', '9');
// Hide some fields
mm_hideFields('link_attributes');
mm_renameField('longtitle', 'Page heading');
mm_renameField('description', 'Search engine description');
// ------------------------ END OF RULES --------------------