Added some helper methods
This commit is contained in:
@@ -162,6 +162,34 @@ class Module extends BaseModule
|
|||||||
return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName;
|
return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this module is a delivery module
|
||||||
|
*/
|
||||||
|
public function isDeliveryModule() {
|
||||||
|
$moduleReflection = new \ReflectionClass($this->getFullNamespace());
|
||||||
|
|
||||||
|
return $moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this module is a payment module
|
||||||
|
*/
|
||||||
|
public function isPayementModule() {
|
||||||
|
$moduleReflection = new \ReflectionClass($this->getFullNamespace());
|
||||||
|
|
||||||
|
return $moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BaseModule a new module instance.
|
||||||
|
*/
|
||||||
|
public function createInstance() {
|
||||||
|
$moduleClass = new \ReflectionClass($this->getFullNamespace());
|
||||||
|
|
||||||
|
return $moduleClass->newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate next position relative to module type
|
* Calculate next position relative to module type
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user