Created
August 20, 2014 13:07
-
-
Save JulienBreux/8d549cac52f28288477e to your computer and use it in GitHub Desktop.
Plugin abstract example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Iadvize\Admin\Plugin; | |
/** | |
* Class PluginAbstract | |
* | |
* @package Iadvize\Admin\Plugin | |
*/ | |
abstract class PluginAbstract | |
{ | |
/** | |
* Get meta data | |
* | |
* @return array | |
*/ | |
public function getMetaData() | |
{ | |
return [ | |
'name' => 'Foo' | |
]; | |
} | |
/** | |
* Get settings | |
* | |
* @return array | |
*/ | |
public function getSettings() | |
{ | |
return [ | |
'FOO' => 'BAR', | |
]; | |
} | |
/** | |
* Get setting | |
* | |
* @param string $name Setting name | |
* | |
* @return mixed | |
*/ | |
public function getSetting($name) | |
{ | |
return 'foo'; | |
} | |
/** | |
* Set setting | |
* | |
* @param string $name Setting name | |
* @param mixed $value Setting value | |
* | |
* @return $this | |
*/ | |
public function setSetting($name, $value) | |
{ | |
return true; | |
} | |
/** | |
* Set settings | |
* | |
* @param array $settings Settings | |
* | |
* @return mixed | |
*/ | |
public function setSettings(array $settings) | |
{ | |
return true; | |
} | |
/** | |
* Remove settings | |
* | |
* @return bool | |
*/ | |
public function removeSettings() | |
{ | |
return true; | |
} | |
/** | |
* Get website | |
* | |
* @return Website | |
*/ | |
public function getWebsite() | |
{ | |
return new \stdClass; | |
} | |
/** | |
* View render | |
* | |
* @param string $template Template | |
* @param array $variables Variables | |
* | |
* @return string | |
*/ | |
public function viewRender($template, array $variables = []) | |
{ | |
return 'foo'; | |
} | |
/** | |
* Translate | |
* | |
* @param string $key Key of translation | |
* | |
* @return mixed | |
*/ | |
public function translate($key) | |
{ | |
return $key; | |
} | |
/** | |
* Get plugin service | |
* | |
* @param string $serviceName Name of service | |
* | |
* @return mixed | |
*/ | |
protected function getPluginService($serviceName) | |
{ | |
return new \stdClass; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment