Ferreteria/v0.5/registry/feature: Difference between revisions
< Ferreteria | v0.5 | registry
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Feature registration== | ==Feature registration== | ||
The Feature Registry exists so that default Feature classes can be replaced (upgraded or modified) with classes provided by {{l/ver|Dropin}}s. The most common example of this is where Systems designed to work headlessly -- such as the {{l/ver|login}} system -- can be upgraded with a graphical interface by a Dropin. | |||
{{l/ver|Feature}} registration for non-{{l/ver|Dropin}} classes from {{l/ferreteria/code|config/portable/features.php}}: | {{l/ver|Feature}} registration for non-{{l/ver|Dropin}} classes from {{l/ferreteria/code|config/portable/features.php}}: | ||
<syntaxhighlight lang=php> | <syntaxhighlight lang=php> | ||
class | use ferret\login as FL; | ||
class csFeatureSetup { | |||
static public function OnSetup() { | static public function OnSetup() { | ||
$oReg = | $oReg = data\caFeature::FeatureClassRegistry(); | ||
$oReg->AddFeature( | // user-login Features | ||
$oReg->AddFeature( | $oReg->AddFeature(FL\account\cFeature::class); | ||
$oReg->AddFeature( | $oReg->AddFeature(FL\client\cFeature::class); | ||
$oReg->AddFeature( | $oReg->AddFeature(FL\group\cFeature::class); | ||
$oReg->AddFeature(FL\permit\cFeature::class); | |||
$oReg->AddFeature(FL\perm\xacct\cFeature::class); | |||
$oReg->AddFeature(FL\session\cFeature::class); | |||
// node-data | |||
$oReg->AddFeature(data\node\cFeature::class); | |||
} | } | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
For an example of how code can read the Feature Registry, see <code>cDropinLink::InvokeFeature()</code>. | |||
For an example of how |
Latest revision as of 13:41, 25 May 2022
Feature registration
The Feature Registry exists so that default Feature classes can be replaced (upgraded or modified) with classes provided by Dropins. The most common example of this is where Systems designed to work headlessly -- such as the login system -- can be upgraded with a graphical interface by a Dropin.
Feature registration for non-Dropin classes from config/portable/features.php:
use ferret\login as FL;
class csFeatureSetup {
static public function OnSetup() {
$oReg = data\caFeature::FeatureClassRegistry();
// user-login Features
$oReg->AddFeature(FL\account\cFeature::class);
$oReg->AddFeature(FL\client\cFeature::class);
$oReg->AddFeature(FL\group\cFeature::class);
$oReg->AddFeature(FL\permit\cFeature::class);
$oReg->AddFeature(FL\perm\xacct\cFeature::class);
$oReg->AddFeature(FL\session\cFeature::class);
// node-data
$oReg->AddFeature(data\node\cFeature::class);
}
}
For an example of how code can read the Feature Registry, see cDropinLink::InvokeFeature()
.