LEAP™ is a content editor’s dream (CMS), a designer’s best option, and the perfect framework for site development.
LEAP™ is simpleLEAPLEAP™ is secureLEAPLEAP™ is SEO-centric

LEAP_ManageFeatures

LEAP™ 5 has a flexible data map that is specific to the content plugin instance. Using LEAP_manageFeatures is appropriate for configuration data and low-volume content data, but not for larger volume text objects.

This section can be read in conjunction with the API plugin guidelines found here.

LEAP_manageFeatures creates and populates a page-level variable of type map called "Feature_Map". This variable is a type of "map" so as to simplify inheritance and enhance backwards compatibility with LEAP™ 3.

Populate

LEAP_manageFeatures->populate

This method will read in any stored data and add them as key/value pairs to the map. This will work for stings, arrays and maps. The latter two data types will be stored as serialized data but will be transparent to your content plugin and seen as native Lasso data types.

Update

The update method will accept a string, a map, or an array as the value component of the pair.

For example:

// storing a string
LEAP_manageFeatures->update('myvar','hello world')

// storing an array
LEAP_manageFeatures->update('myvar',array('hello','world'))

// storing a map
LEAP_manageFeatures->update('myvar',map('hello'='world','name'='Jeremy'))

Displaying

Because LEAP_ManageFeatures populates a variable of type map, accessing the data is exactly like addressing any other Lasso 9 map.

Once LEAP_manageFeatures->populate has been invoked, if a feature named "firstname" has been previously initialized and/or stored, the current value of this feature can be accessed like this:

$Feature_Map->find('firstName')
-> Jeremy

Common usages

Here are a few examples of how LEAP_ManageFeatures is used within LEAP™ plugins.

Initialize, setup and prime with data

LEAP_manageFeatures->populate
local(featurelist = map(
		'firstName'	= 'Jeremy',
		'profile'	= 'I am a gnome'
	)
)

with i in #featurelist->keys do => {
	$Feature_Map->find(#i)->isA('void') ? 
		LEAP_manageFeatures->update(#i,#featurelist->find(#i)) 
}

Saving data within a save handler

with i in #featurelist->keys do => { 
	LEAP_manageFeatures->update(#i,string(client_param('LEAP_'+#i))->trim &) 
}

© Copyright LEAP™ 2017 | Privacy Policy | Design by Treefrog Inc.