Jump to content

This template group already exists

Go to solution Solved by Daniel F,

Recommended Posts

In CMS Templates, when I try to create a new group for JS Files I get the error: This template group already exists.


The template group does not exist, though. At least not in JS files. There is indeed a template group with the same name in CSS files. In applications/cms/modules/admin/pages/templates.php line 615 you check if the group exists without checking template_location:

$form->add( new \IPS\Helpers\Form\Text( 'template_group_new', NULL, FALSE, array( 'regex' => '/^([a-z_][a-z0-9_]+?)?$/' ), function( $val ) {
					$count = \IPS\Db::i()->select( 'COUNT(*)', 'cms_templates', array( "LOWER(template_group)=?", mb_strtolower( str_replace( ' ', '_', $val ) )  ) )->first();
					if ( $count )
						throw new \DomainException( 'cms_template_group_exists' );
				catch( \UnderflowException $e ) {}
			}, NULL, NULL, 'group_new' ) );

$count returns 1 even if the template group exists in Pages or CSS.

Additional WHERE on cms_templates.template_location is required or the error message should inform that you can only ONE template group with the same name across the entire suite.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...