Skip to content

Commit

Permalink
Update for slug max length.
Browse files Browse the repository at this point in the history
  • Loading branch information
teonator committed Apr 8, 2024
1 parent 748bf44 commit ba8a105
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions services/HTMLImportService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ component {

property name="siteTreeService" inject="SiteTreeService";
property name="assetManagerService" inject="AssetManagerService";
property name="presideObjectService" inject="PresideObjectService";
property name="dynamicFindAndReplaceService" inject="DynamicFindAndReplaceService";
property name="htmlImportStorageProvider" inject="HTMLImportStorageProvider";

Expand Down Expand Up @@ -159,14 +160,16 @@ component {
$announceInterception( "preHTMLImportPages", { pages=arguments.pages, data=arguments.data } );

var totalPages = ArrayLen( arguments.pages );
var pageTypeName = $translateResource( uri="page-types.#arguments.childPagesType#:name", defaultValue=arguments.childPagesType );

if ( totalPages ) {
var pageTypeName = "";
var pageSlugLength = presideObjectService.getObjectPropertyAttribute( objectName="page", propertyName="slug", attributeName="maxLength", defaultValue=50 );

var parentPage = siteTreeService.getPage( id=arguments.parentPageId, selectFields=[ "id", "title", "_hierarchy_slug", "page_type" ], allowDrafts=true );

for ( var i=1; i<=totalPages; i++ ) {
var title = $helpers.isEmptyString( arguments.pages[ i ].title ) ? parentPage.title : arguments.pages[ i ].title;
var slug = $helpers.slugify( title );
var slug = $helpers.slugify( str=title, maxLength=pageSlugLength );

var pageId = "";
var pageType = "";
Expand Down

0 comments on commit ba8a105

Please sign in to comment.