//-- Add the individual list item chunk
$chunks[8] = $modx->newObject('modChunk');
$chunks[8]->fromArray(array('id' => 1, 'name' => 'tplHeading', 'description' => 'The template to use as the calendar heading and navigation controls. This could set to empty in order to return a fixed calendar whereby the user would not have direct navigation of other months.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/month.inner.container.row.heading.chunk.tpl')), '', true, true);
//-- Add the individual list item chunk
$chunks[9] = $modx->newObject('modChunk');
$chunks[9]->fromArray(array('id' => 1, 'name' => 'tplDetail', 'description' => 'The template to use as the event detail view.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/detail.chunk.tpl')), '', true, true);
//-- Add the individual list item chunk
$chunks[10] = $modx->newObject('modChunk');
$chunks[10]->fromArray(array('id' => 1, 'name' => 'tplListItemTraditional', 'description' => 'This is a carry over from the traditional mxCalendar Evo version of the fields in the list view.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/el.item.chunk.tpl')), '', true, true);
//-- Add the individual list item chunk
$chunks[11] = $modx->newObject('modChunk');
$chunks[11]->fromArray(array('id' => 1, 'name' => 'tplEventTraditional', 'description' => 'This is a carry over from the traditional mxCalendar Evo version of the fields in the calendar view.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/month.inner.container.row.day.event.chunk.tpl')), '', true, true);
//-- Add the individual list item chunk
$chunks[12] = $modx->newObject('modChunk');
$chunks[12]->fromArray(array('id' => 1, 'name' => 'tplCategoryWrap', 'description' => 'The outer container for the cateogry listing when enabled for the calendar display.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/category.container.chunk.tpl')), '', true, true);
//-- Add the individual list item chunk
$chunks[13] = $modx->newObject('modChunk');
$chunks[13]->fromArray(array('id' => 1, 'name' => 'tplCategoryItem', 'description' => 'The inside container that holds the category output.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/category.container.item.chunk.tpl')), '', true, true);
//-- Add the modal detail item chunk
$chunks[14] = $modx->newObject('modChunk');
$chunks[14]->fromArray(array('id' => 1, 'name' => 'tplDetailModal', 'description' => 'The template file for use with the AJAX modal detail view.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/detail.modal.chunk.tpl')), '', true, true);
//-- Add the image item chunk
$chunks[15] = $modx->newObject('modChunk');
$chunks[15]->fromArray(array('id' => 1, 'name' => 'tplImageItem', 'description' => 'Image item default chunk used in both the List and Detail views.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/image.chunk.tpl')), '', true, true);
//-- Add the no events chunk
$chunks[16] = $modx->newObject('modChunk');
$chunks[16]->fromArray(array('id' => 1, 'name' => 'tplNoEvents', 'description' => 'No events chunk to display in list display mode.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/el.noevents.chunk.tpl')), '', true, true);
//-- Add the search chunk
$chunks[17] = $modx->newObject('modChunk');
$chunks[17]->fromArray(array('id' => 1, 'name' => 'tplSearch', 'description' => 'Default search form template.', 'snippet' => getChunkContent($sources['elements'] . 'chunks/search.chunk.tpl')), '', true, true);
return $chunks;
Example #2
0
<?php

$chnks = array('modshopifyOuter' => 'Tpl chunk for the outer container', 'modshopifyProduct' => 'Tpl chunk for a single product', 'modshopifyProductImg' => 'Tpl chunk for a single product image', 'modshopifyProductVariant' => 'Tpl chunk for a single product variant');
function getChunkContent($filename = '')
{
    $o = file_get_contents($filename);
    $o = trim($o);
    return $o;
}
$chunks = array();
$idx = 0;
foreach ($chnks as $cn => $cdesc) {
    $idx++;
    $chunks[$idx] = $modx->newObject('modChunk');
    $chunks[$idx]->fromArray(array('id' => $idx, 'name' => $cn, 'description' => $cdesc, 'snippet' => getChunkContent($sources['chunks'] . $cn . '.tpl')));
}
return $chunks;
 * Copyright 2012 by Kévin PAUSÉ (kevin.pause@supinfo.com)
 * Development funded by Ackwa, agency based at Larçay, Indre-et-Loire, Centre, FRANCE.
 *
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
function getChunkContent($filename)
{
    $o = file_get_contents($filename);
    return $o;
}
$chunks = array();
$chunks[1] = $modx->newObject('modChunk');
$chunks[1]->fromArray(array('name' => 'UserEmailChunk', 'description' => 'Chunk for the email which will be sent to the user.', 'snippet' => getChunkContent($aSources['chunks'] . 'userEmail.chunk.php')), '', true, true);
$chunks[2] = $modx->newObject('modChunk');
$chunks[2]->fromArray(array('name' => 'AdminEmailChunk', 'description' => 'Chunk for the email which will be sent to the administrator.', 'snippet' => getChunkContent($aSources['chunks'] . 'adminEmail.chunk.php')), '', true, true);
return $chunks;
{
    $o = file_get_contents($filename);
    $o = trim($o);
    return $o;
}
$chunks = array();
$chunks['dbtBase'] = $modx->newObject('modChunk');
$chunks['dbtBase']->fromArray(array('name' => 'dbtBase', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtBase.html')), '', true, true);
$chunks['dbtBasicItem'] = $modx->newObject('modChunk');
$chunks['dbtBasicItem']->fromArray(array('name' => 'dbtBasicItem', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtBasicItem.html')), '', true, true);
$chunks['dbtHeaders'] = $modx->newObject('modChunk');
$chunks['dbtHeaders']->fromArray(array('name' => 'dbtHeaders', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtHeaders.html')), '', true, true);
$chunks['dbtLog'] = $modx->newObject('modChunk');
$chunks['dbtLog']->fromArray(array('name' => 'dbtLog', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtLog.html')), '', true, true);
$chunks['dbtLogItem'] = $modx->newObject('modChunk');
$chunks['dbtLogItem']->fromArray(array('name' => 'dbtLogItem', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtLogItem.html')), '', true, true);
$chunks['dbtNavItem'] = $modx->newObject('modChunk');
$chunks['dbtNavItem']->fromArray(array('name' => 'dbtNavItem', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtNavItem.html')), '', true, true);
$chunks['dbtPanel'] = $modx->newObject('modChunk');
$chunks['dbtPanel']->fromArray(array('name' => 'dbtPanel', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtPanel.html')), '', true, true);
$chunks['dbtSql'] = $modx->newObject('modChunk');
$chunks['dbtSql']->fromArray(array('name' => 'dbtSql', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtSql.html')), '', true, true);
$chunks['dbtSqlItem'] = $modx->newObject('modChunk');
$chunks['dbtSqlItem']->fromArray(array('name' => 'dbtSqlItem', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtSqlItem.html')), '', true, true);
$chunks['dbtTiming'] = $modx->newObject('modChunk');
$chunks['dbtTiming']->fromArray(array('name' => 'dbtTiming', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtTiming.html')), '', true, true);
$chunks['dbtParserItem'] = $modx->newObject('modChunk');
$chunks['dbtParserItem']->fromArray(array('name' => 'dbtParserItem', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtParserItem.html')), '', true, true);
$chunks['dbtParser'] = $modx->newObject('modChunk');
$chunks['dbtParser']->fromArray(array('name' => 'dbtParser', 'description' => '', 'snippet' => getChunkContent($sources['elements'] . 'chunks/dbtParser.html')), '', true, true);
return $chunks;