Extending DMTHML - ftlabel not updating

Hello,

I am trying to extend the html object in my project. Any changes to the ftlabel attribute on the title field are not reflecting in the webtop. I verified application.stCOAPI.dmHTML.packagepath and I am extending html in my project as follows

<cfcomponent name="dmHTML" extends="farcry.core.packages.types.dmHTML" displayname="HTML Page" 
	hint="Forms the basis of the content framework of the site. HTML content items often include containers and publishing rules." 
	bUseInTree="1" bFriendly="1" fuAlias="html" bObjectBroker="1">

I can add new fields and edit those, but not the existing fields.

Can you post the whole of your extended dmHTML.cfc? The devil will be in the detail of the cfproperty tags.

It’s also possible that those labels have been put into the translation lookup files, in which case you will need to override those in your project. In core look for .properties files in /packages/resources/. They have translation keys in the form:

# @translated true     @created 2008-10-13 @modified 2008-10-13 @createdby
@modifier farcry
# @comment
coapi.dmHTML.properties.Body@label=Body

You can replicate that file structure (e.g.
/packages/resources/admin_en_AU.properties) in your project, with the files only containing those values you want to override. Then restart your application. FarCry will automatically resolve the translations and prioritise values in the project.

Blair

In core, the dmHTML content type has language translations which are specified in resource bundles (.properties files), and these take precedence over the raw strings that are in the code.

You’d need to create a resource bundle to put into the project (or plugin) that you’re editing to be able to override that label, e.g.

# @translated true     @created 2008-10-13 @modified 2008-10-13 @createdby  @modifier farcry
# @comment 
coapi.dmHTML.properties.Title@label=Title

Thanks! for assist I’ll overriding the resource bundle.

Here is the rest of the extended cfc:

<cfcomponent name="dmHTML" extends="farcry.core.packages.types.dmHTML" displayname="HTML Page" 
	hint="Forms the basis of the content framework of the site. HTML content items often include containers and publishing rules." 
	bUseInTree="1" bFriendly="1" fuAlias="html" bObjectBroker="1">
<!---------------------------------------------------------------
type properties
---------------------------------------------------------------->	
<cfproperty 
	name="Title" type="string" hint="Title of content item." required="no" default="" ftType="string" ftLabel="Long Title"
	ftSeq="1" ftwizardStep="Web Page" ftFieldset="General Details" ftValidation="required" 
	ftHint="Test Title This title will appear as the major title on the page. It should not be confused with the title that appears in the navigation.">

<cfproperty 
	name="displayMethod" type="string" hint="Display method to render this HTML object with." required="yes" default="displayPageStandard" 
	ftSeq="4" ftwizardStep="Web Page" ftFieldset="General Details" ftLabel="Page Test Layout" 
	ftHint="This selection will determine the overall layout of the page."
	ftType="webskin" ftPrefix="displayPage" >

<cfproperty 
	name="TeaserTest" type="longchar" ftLabel="Test Long Teaser" ftType="longchar" hint="Test Teaser text." required="no" default=""
	ftSeq="5" ftwizardStep="Web Page" ftFieldset="Teaser"
	ftAutoResize="true">

<cfproperty 
	name="ShortTeaser" type="longchar" ftLabel="Short Test Teaser" ftType="richtext" hint="Teaser text." required="no" default=""
	ftSeq="8" ftwizardStep="Web Page" ftFieldset="Teaser">

<cfproperty 
	name="Teaser" type="longchar" ftLabel="Long Teaser" ftType="longchar" hint="Teaser text." required="no" default=""
	ftSeq="9" ftwizardStep="Web Page" ftFieldset="Teaser"
	ftAutoResize="true">

<cfproperty 
	name="TeaserAlt" type="longchar" ftLabel="Alt. Teaser" ftType="longchar" hint="Teaser text." required="no" default=""
	ftSeq="10" ftwizardStep="Web Page" ftFieldset="Teaser"
	ftAutoResize="true">
	
<cfproperty 
	name="teaserImage" type="uuid" ftType="uuid" hint="UUID of image to display in teaser" required="no" default=""
	ftSeq="11" ftwizardStep="Web Page" ftFieldset="Teaser" ftLabel="Teaser Image"
	ftJoin="dmImage" ftLibraryData="getTeaserImageLibraryData" ftLibraryDataTypename="dmHTML">

<cfproperty 
	name="Body" type="longchar" hint="Main body of content." required="no" default="" 
	ftSeq="12" ftwizardStep="Web Page" ftFieldset="Body" ftLabel="Test Body" 
	ftType="richtext" 
	ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage"
	ftTemplateTypeList="dmImage,dmFile,dmNavigation,dmHTML" ftTemplateWebskinPrefixList="insertHTML"
	ftLinkListFilterRelatedTypenames="dmFile,dmNavigation,dmHTML"
	ftTemplateSnippetWebskinPrefix="insertSnippet">

<cfproperty 
	name="aObjectIDs" type="array" hint="Related media items for this content item." required="no" default=""
	ftSeq="13" ftwizardStep="Web Page" ftFieldset="Relationships" ftLabel="Associated Media" 
	ftType="array" ftJoin="dmImage,dmFile,dmFlash" 
	ftShowLibraryLink="false" ftAllowAttach="true" ftAllowAdd="true" ftAllowEdit="true" ftRemoveType="detach"
	bSyncStatus="true">

<cfproperty 
	name="aRelatedIDs" type="array" ftType="array" hint="Holds object pointers to related objects. Can be of mixed types." required="no" default="" 
	ftSeq="14" ftwizardStep="Web Page" ftFieldset="Relationships" ftLabel="Associated Content"
	ftJoin="dmNavigation,dmHTML" >

<!--- 
 // seo
---------------------------------------------------------------->
<cfproperty 
	name="seoTitle" type="string" hint="SEO title of content item." required="no" default="" 
	ftSeq="32" ftwizardStep="SEO" ftFieldset="SEO" ftlabel="Test Short Title"
	ftlimit="69" ftLimitOverage="warn" ftAutoResize="true"
	ftHint="Test If specified, the SEO title will be used instead of the page title for the TITLE tag. This title will be used as the preferred title by search engines. Different search engines have different lengths of snippet title: Google 69, Yahoo 72, Bing 65."
	fttype="longchar"
	fthelptitle="Search Engine Optimization" 
	ftHelpSection="The keywords and description that you enter here will provide search engines with extra information that describes your page. Remember that a good SEO strategy is much more than just a good description and keywords." blabel="true" />
	
<cfproperty 
	name="extendedmetadata" type="longchar" hint="HTML head section for extended keywords." required="no" default=""
	ftSeq="35" ftwizardStep="SEO" ftFieldset="SEO" ftlabel="Description Tag"
	ftHint="Test Concise summary of the page. Different search engines have different character limits (including spaces) for their search snippet: Google 156, Yahoo 161, Bing 150."
	ftType="longchar" ftLimit="170" ftLimitOverage="warn"
	ftAutoResize="true" />

<cfproperty 
	name="metaKeywords" type="longchar" hint="HTML head section metakeywords." required="no" default="" 
	ftSeq="38" ftwizardStep="SEO" ftFieldset="SEO" ftLabel="Keyword Tag(s)"
	ftHint="Keep it simple and relevant: 10-20 keywords per page. Limited to 900 characters including spaces."
	ftType="longchar" ftLimit="900"
	ftAutoResize="true" ftLimitOverage="warn" />

<cfproperty 
	name="ownedby" displayname="Owned by" type="string" hint="Username for owner." required="No" default=""
	ftSeq="50" ftwizardStep="Miscellaneous" ftFieldset="Content Details" ftLabel="Owned By"
	ftHint="This should be set to the person responsible for this page. Any questions... ask this person."
	ftType="list" ftRenderType="dropdown" ftListData="getOwners" >
	
<cfproperty 
	name="reviewDate" type="date" hint="The date for which the object will be reviewed." required="no" default=""
	ftSeq="52" ftwizardStep="Miscellaneous" ftFieldset="Content Details" ftLabel="Review Date" 
	ftHint="Optionally enter a date to remind you when this content should be reviewed."
	ftType="datetime" ftToggleOffDateTime="true" ftShowTime="false">
	
<cfproperty 
	name="catHTML" type="string" hint="Topic." required="no" default="" 
	ftSeq="54" ftwizardStep="Miscellaneous" ftFieldset="Content Details" ftLabel="Categories"
	ftType="Category" ftAlias="root" />

<!---------------------------------------------------------------
object methods 
---------------------------------------------------------------->
<cffunction name="deleteRelatedIds" hint="Deletes references to a given uuid in the dmHTML_relatedIds table">
	<cfargument name="objectid" required="yes" type="uuid">
	<cfargument name="dsn" required="no" default="#application.dsn#">
	<cfargument name="dbowner" required="no" default="#application.dbowner#">
	
	<cfset var q = ''>
	<cfquery name="q" datasource="#arguments.dsn#">
		DELETE FROM #application.dbowner#dmHTML_aRelatedIDs
		WHERE parentid = '#arguments.objectid#'
	</cfquery>
	
</cffunction>

<cffunction name="delete" access="public" hint="Specific delete method for dmHTML. Removes all descendants">
	<cfargument name="objectid" required="yes" type="UUID" hint="Object ID of the object being deleted">
	<cfargument name="dsn" required="yes" type="string" default="#application.dsn#">
	
	<!--- get object details --->
	<cfset var stObj = getData(arguments.objectid)>
	
	<cfset var oHTML = createObject("component", application.stcoapi.dmHTML.packagePath) />
	<cfset var stHTML = structNew() />
	<cfset var qRelated = queryNew("blah") />
	<cfset var qDeleteRelated = queryNew("blah") />
	
	<cfset var stReturn = structNew() />
	
	<cfif NOT structIsEmpty(stObj)>
		
		<cfset stReturn = super.delete(stObj.objectId) />
		
		<!--- Find any dmHTML pages that reference this html page. --->
		<cfquery datasource="#application.dsn#" name="qRelated">
		SELECT parentid FROM dmHTML_aRelatedIDs
		WHERE data = '#stobj.objectid#'
		</cfquery>
		
		<cfif qRelated.recordCount>

			<!--- Delete any of these relationships --->
			<cfquery datasource="#application.dsn#" name="qDeleteRelated">
			DELETE FROM dmHTML_aRelatedIDs
			WHERE data = '#stobj.objectid#'
			</cfquery>
						
			<!--- Remove deleted objects from object broker if required --->
			<cfset application.fc.lib.objectbroker.RemoveFromObjectBroker(lObjectIDs="#valueList(qRelated.parentID)#", typename="dmHTML") />	
			
			<cfloop query="qRelated">
				<cfset stHTML = oHTML.getData(objectid=qRelated.parentid, bUseInstanceCache=false) />				
			</cfloop>		
						
		</cfif>
		
		<cfreturn stReturn>
	<cfelse>
		
		<cfset stReturn.bSuccess = false>
		<cfset stReturn.message = "#arguments.objectid# (dmHTML) not found.">
		<cfreturn stReturn>
		
	</cfif>
</cffunction>

<cffunction name="getTeaserImageLibraryData" access="public" output="false" returntype="query" hint="Return a query for all images already associated to this object.">
	<cfargument name="primaryID" type="uuid" required="true" hint="ObjectID of the object that we are attaching to" />
	<cfargument name="qFilter" type="query" required="false" default="#queryNew('key')#" hint="If a library verity search has been run, this is the qResultset of that search" />
	
	<cfset var q = queryNew("blah") />
		
	<!--- 
	Run the entire query and return in to the library. Let the library handle the pagination.
	 --->
	<cfquery datasource="#application.dsn#" name="q">
	SELECT data as objectid, dmImage.label, dmImage.thumbnailimage, dmImage.title, dmImage.alt
	FROM dmHTML_aObjectIDs 
	INNER JOIN 
		 dmImage ON dmHTML_aObjectIDs.data = dmImage.objectid
	WHERE parentid = '#arguments.primaryID#'
	<cfif qFilter.RecordCount>
		AND data IN (<cfqueryparam cfsqltype="cf_sql_varchar" list="true" value="#qFilter.key#" />)
	</cfif>
	ORDER BY seq
	</cfquery>
	
	<cfreturn q />
	
</cffunction>

</cfcomponent>

When you extend a content type into your project, you only need the bits you’re going to change or add.

For example, if you wanted to add a new property called SubTitle you only need the component tag and the cfproperty tag for the new property. All the other meta and functions will be automatically inherited through the extends="farcry.core.packages.types.dmHTML" attribute.

<cfcomponent name="dmHTML" extends="farcry.core.packages.types.dmHTML" displayname="HTML Page" 
	hint="Forms the basis of the content framework of the site. HTML content items often include containers and publishing rules." 
	bUseInTree="1" bFriendly="1" fuAlias="html" bObjectBroker="1">
<cfproperty 
	name="SubTitle" type="string" hint="Sub title of content item." required="no" default="" ftType="string" ftLabel="Sub Title"
	ftSeq="2" ftwizardStep="Web Page" ftFieldset="General Details">
</cfcomponent>

Hope that helps!

Thanks everyone - overriding the resource bundle worked like a charm.

I copied the resources folder from core to my project and did this test in admin_en_US.properties:

coapi.dmHTML.buttons.createtype@label=Create\ HTML\ Page
coapi.dmHTML.properties.Title@label=Long\ Title

Which updated the label on the title field.

1 Like