Jump to content

This template group already exists


Sonya*
 Share

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.

screenshot-2022_01.12-10_47_24.thumb.png.8f2660c7d3b33cd74d0b36246a0a019d.png

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 ) {
				try
				{
					$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

 Share

  • Recently Browsing   0 members

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