Skip to content

Instantly share code, notes, and snippets.

@JulienBreux
Created August 20, 2014 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JulienBreux/8d549cac52f28288477e to your computer and use it in GitHub Desktop.
Save JulienBreux/8d549cac52f28288477e to your computer and use it in GitHub Desktop.
Plugin abstract example
<?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