public static function smarty_compiler_moduleblock($params, $smarty) { // {content_image} tag encountered. if (!isset($params['block']) || empty($params['block'])) { throw new CmsEditContentException('{content_module} tag requires block parameter'); } $rec = array('type' => 'module', 'id' => '', 'name' => '', 'module' => '', 'label' => '', 'blocktype' => '', 'tab' => ''); $parms = array(); foreach ($params as $key => $value) { if ($key == 'block') { $key = 'name'; } $value = trim(trim($value, '"\'')); if (isset($rec[$key])) { $rec[$key] = $value; } else { $parms[$key] = $value; } } if (!$rec['name']) { $n = count(self::$_contentBlocks) + 1; $rec['id'] = $rec['name'] = 'module_' + $n; } if (!$rec['id']) { $rec['id'] = str_replace(' ', '_', $rec['name']); } $rec['params'] = $parms; if ($rec['module'] == '') { throw new CmsEditContentException('Missing module param for content_module tag'); } // check for duplicate. if (isset(self::$_contentBlocks[$rec['name']])) { throw new CmsEditContentException('Duplicate content block: ' . $rec['name']); } if (!is_array(self::$_contentBlocks)) { self::$_contentBlocks = array(); } self::$_contentBlocks[$rec['name']] = $rec; }