-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup the block interface, add internal base block teste, added
concret implementation block closes #1063
- Loading branch information
Showing
18 changed files
with
564 additions
and
48 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
<?php | ||
|
||
namespace app\blocks; | ||
|
||
use luya\cms\base\BlockInterface; | ||
use luya\cms\frontend\blockgroups\DevelopmentGroup; | ||
|
||
class ConcreptImplementationBlock implements BlockInterface | ||
{ | ||
/** | ||
* Get the name of the block in order to display in administration context. | ||
*/ | ||
public function name() | ||
{ | ||
return 'Concrept Block'; | ||
} | ||
|
||
/** | ||
* Returns the configuration array. | ||
* | ||
* @return array | ||
*/ | ||
public function config() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Returns the icon based on material icon names | ||
* | ||
* @return string | ||
*/ | ||
public function icon() | ||
{ | ||
return '<i class="fa fa-icon">icon</i>'; | ||
} | ||
|
||
/** | ||
* Get the output in the frontend context. | ||
* | ||
* @return string | ||
*/ | ||
public function renderFrontend() | ||
{ | ||
return 'frontend!'; | ||
} | ||
|
||
/** | ||
* Get the output in administration context. | ||
* | ||
* @return string | ||
*/ | ||
public function renderAdmin() | ||
{ | ||
return 'admin!'; | ||
} | ||
|
||
/** | ||
* Returns a class of the blocks group. | ||
* | ||
* @return \luya\cms\base\BlockGroup | ||
*/ | ||
public function getBlockGroup() | ||
{ | ||
return DevelopmentGroup::class; | ||
} | ||
|
||
// getters & setters from outside | ||
|
||
/** | ||
* The the full name based on icon() and name() concated. | ||
* | ||
* @return string | ||
*/ | ||
public function getFullName() | ||
{ | ||
return $this->name(); | ||
} | ||
|
||
/** | ||
* Returns an array with additional help informations for specific field (var or cfg). | ||
* | ||
* @return array An array where the key is the cfg/var field var name and the value the helper text. | ||
*/ | ||
public function getFieldHelp() | ||
{ | ||
return []; | ||
} | ||
|
||
private $_envs = []; | ||
|
||
/** | ||
* Set an environment option informations to the block with key value pairing. | ||
* | ||
* @param string $key The identifier key. | ||
* @param mixed $value The value for the key. | ||
*/ | ||
public function setEnvOption($key, $value) | ||
{ | ||
$this->_envs[$key] = $value; | ||
} | ||
|
||
private $_vars; | ||
|
||
/** | ||
* Set the values for element vars with an array key value binding. | ||
* | ||
* @param array $values An array where key is the name of the var-element and value the content. | ||
*/ | ||
public function setVarValues(array $values) | ||
{ | ||
$this->_vars = $values; | ||
} | ||
|
||
private $_cfgs = []; | ||
|
||
/** | ||
* Set the values for element cfgs with an array key value binding. | ||
* | ||
* @param array $values An array where key is the name of the cfg-element and value the content. | ||
*/ | ||
public function setCfgValues(array $values) | ||
{ | ||
$this->_cfgs = $values; | ||
} | ||
|
||
private $_placeholders = []; | ||
|
||
/** | ||
* Set the value from placeholders where the array key is the name of value the content of the placeholder. | ||
* | ||
* @param array $placeholders An array with placeholders where key is name and the value the content e.g. `['content' => 'The placheholder Content']`. | ||
*/ | ||
public function setPlaceholderValues(array $placeholders) | ||
{ | ||
$this->_placeholders = $placeholders; | ||
} | ||
|
||
/** | ||
* Returns an array of key value pairing with additional informations to pass to the API and frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function extraVarsOutput() | ||
{ | ||
return ['foo' => 'bar']; | ||
} | ||
|
||
/** | ||
* Returns all config vars element of key value pairing to pass to the API and frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function getVars() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Returns all config cfgs element of key value pairing to pass to the API and frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function getCfgs() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Returns all config placeholders element of key value pairing to pass to the API and frontend. | ||
* | ||
* @return array | ||
*/ | ||
public function getPlaceholders() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Whether cache is enabled for this block or not. | ||
* | ||
* @return boolean | ||
*/ | ||
public function getIsCacheEnabled() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* The time of cache expiration | ||
*/ | ||
public function getCacheExpirationTime() | ||
{ | ||
return 60; | ||
} | ||
|
||
/** | ||
* Whether is an container element or not. | ||
*/ | ||
public function getIsContainer() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* Return an array of assets | ||
* | ||
* @todo remove in rc1 | ||
* @return array | ||
*/ | ||
public function getAssets() | ||
{ | ||
return []; | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.