Difference between revisions of "Ferreteria/v0.3/class/fcrDropInModule"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ferreteria‎ | v0.3‎ | class
Jump to navigation Jump to search
(Created page with "{{page/code/class|ferreteria}} <source lang=php> /*:::: FIELDS: [name]: short name for module [descr]: one-line description [version]: version number (can be non...")
 
 
(3 intermediate revisions by the same user not shown)
Line 50: Line 50:
 
}
 
}
 
</source>
 
</source>
* '''file''': <code>/dropin.php</code>
+
* '''file''': {{l/ferreteria/file|dropin.php}}
* '''extends''': {{l/ferreteria/class|cIORow_sourced}}
+
* '''extends''': {{l/ferreteria/class|cFieldRow_sourced}}
 
* '''table class''': {{l/ferreteria/class|fcDropInManager}}
 
* '''table class''': {{l/ferreteria/class|fcDropInManager}}

Latest revision as of 15:28, 3 February 2020

/*::::
  FIELDS:
    [name]: short name for module
    [descr]: one-line description
    [version]: version number (can be non-numeric)
    [date]: release date in YYYY/MM/DD format
    [URL]: URL for more information about the module
*/
class fcrDropInModule extends ferreteria\data\cIORow_sourced {

    // ++ SETUP ++ //
    
    // ACTION: Load specs array and do any additional per-module processing.
    public function SetSpecs(array $arSpecs) {
	$this->SetValues($arSpecs);
	$this->RegisterClasses();
    }
    /*----
      ACTION: register any classes defined within the dropin.
    */
    protected function RegisterClasses() {
	$arCls = $this->ClassArray();
	foreach ($arCls as $sFile => $sClasses) {
	    $om = new fcCodeModule(__FILE__, $sFile);
	    if (is_array($sClasses)) {
		// value is an array of class names for file $sFile
		foreach ($sClasses as $sClass) {
		    $om->AddClass($sClass);
		}
	    } else {
		// assume value is a single class name
		$om->AddClass($sClasses);
	    }
	}
    }

    // -- SETUP -- //
    // ++ FIELD VALUES ++ //

    public function Name() {
	return $this->GetValue('name');
    }
    protected function ClassArray() {
	return $this->GetValue('classes');
    }

    // -- FIELD VALUES -- //
}