Skip to content

Commit

Permalink
change methods names for consistency #1070
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Nov 1, 2016
1 parent 724cc9c commit 646a81d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions envs/dev/blocks/ConcreptImplementationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function setPlaceholderValues(array $placeholders)
*
* @return array
*/
public function getExtraVarsExport()
public function getExtraVarValues()
{
return ['foo' => 'bar'];
}
Expand All @@ -141,7 +141,7 @@ public function getExtraVarsExport()
*
* @return array
*/
public function getVarsExport()
public function getConfigVarsExport()
{
return [];
}
Expand All @@ -151,7 +151,7 @@ public function getVarsExport()
*
* @return array
*/
public function getCfgsExport()
public function getConfigCfgsExport()
{
return [];
}
Expand All @@ -161,7 +161,7 @@ public function getCfgsExport()
*
* @return array
*/
public function getPlaceholdersExport()
public function getConfigPlaceholdersExport()
{
return [];
}
Expand Down
14 changes: 7 additions & 7 deletions modules/cms/src/base/BlockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,28 @@ public function setPlaceholderValues(array $placeholders);
*
* @return array
*/
public function getExtraVarsExport();
public function getExtraVarValues();

/**
* Returns all config vars element of key value pairing to pass to the API and frontend.
* Returns all config vars element of key value pairing to pass to the Admin ANGULAR API
*
* @return array
*/
public function getVarsExport();
public function getConfigVarsExport();

/**
* Returns all config cfgs element of key value pairing to pass to the API and frontend.
* Returns all config cfgs element of key value pairing to pass to the Admin ANGULAR API
*
* @return array
*/
public function getCfgsExport();
public function getConfigCfgsExport();

/**
* Returns all config placeholders element of key value pairing to pass to the API and frontend.
* Returns all config placeholders element of key value pairing to pass to the Admin ANGULAR API
*
* @return array
*/
public function getPlaceholdersExport();
public function getConfigPlaceholdersExport();

/**
* Whether cache is enabled for this block or not.
Expand Down
8 changes: 4 additions & 4 deletions modules/cms/src/base/InternalBaseBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function addExtraVar($key, $value)
private $_extraVars = [];

// access from outside
public function getExtraVarsExport()
public function getExtraVarValues()
{
$this->_extraVars = ArrayHelper::merge($this->_extraVars, $this->extraVars());
return $this->_extraVars;
Expand All @@ -370,7 +370,7 @@ public function getFieldHelp()
/**
* @return array
*/
public function getVarsExport()
public function getConfigVarsExport()
{
$config = $this->config();

Expand All @@ -391,7 +391,7 @@ public function addVar(array $varConfig)
/**
* @return array
*/
public function getPlaceholdersExport()
public function getConfigPlaceholdersExport()
{
return (array_key_exists('placeholders', $this->config())) ? $this->config()['placeholders'] : [];
}
Expand All @@ -401,7 +401,7 @@ public function getPlaceholdersExport()
/**
* @return array
*/
public function getCfgsExport()
public function getConfigCfgsExport()
{
$config = $this->config();

Expand Down
2 changes: 1 addition & 1 deletion modules/cms/src/base/TwigBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function renderFrontend()
'vars' => $this->getVarValues(),
'cfgs' => $this->getCfgValues(),
'placeholders' => $this->getPlaceholderValues(),
'extras' => $this->getExtraVarsExport(),
'extras' => $this->getExtraVarValues(),
]);
}

Expand Down
10 changes: 5 additions & 5 deletions modules/cms/src/models/NavItemPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $pr

// render sub placeholders and set into object
$insertedHolders = [];
foreach ($blockObject->getPlaceholdersExport() as $item) {
foreach ($blockObject->getConfigPlaceholdersExport() as $item) {
$insertedHolders[$item['var']] = $this->renderPlaceholderRecursive($navItemPageId, $item['var'], $placeholder['id']);
}
$blockObject->setPlaceholderValues($insertedHolders);
Expand Down Expand Up @@ -340,7 +340,7 @@ public static function getBlock($blockId)

$placeholders = [];

foreach ($blockObject->getPlaceholdersExport() as $pk => $pv) {
foreach ($blockObject->getConfigPlaceholdersExport() as $pk => $pv) {
$pv['nav_item_page_id'] = $blockItem['nav_item_page_id'];
$pv['prev_id'] = $blockItem['id'];
$placeholderVar = $pv['var'];
Expand Down Expand Up @@ -369,9 +369,9 @@ public static function getBlock($blockId)
'icon' => $blockObject->icon(),
'full_name' => ($blockObject->icon() === null) ? $blockObject->name() : '<i class="material-icons">'.$blockObject->icon().'</i> <span>'.$blockObject->name().'</span>',
'twig_admin' => $blockObject->renderAdmin(),
'vars' => $blockObject->getVarsExport(),
'cfgs' => $blockObject->getCfgsExport(),
'extras' => $blockObject->getExtraVarsExport(),
'vars' => $blockObject->getConfigVarsExport(),
'cfgs' => $blockObject->getConfigCfgsExport(),
'extras' => $blockObject->getExtraVarValues(),
'values' => $blockItem['json_config_values'],
'field_help' => $blockObject->getFieldHelp(),
'cfgvalues' => $blockItem['json_config_cfg_values'], // add: t1_json_config_cfg_values
Expand Down
8 changes: 4 additions & 4 deletions modules/cms/tests/data/blocks/ConcretImplementationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function setPlaceholderValues(array $placeholders)
*
* @return array
*/
public function getExtraVarsExport()
public function getExtraVarValues()
{
return ['foo' => 'bar'];
}
Expand All @@ -142,7 +142,7 @@ public function getExtraVarsExport()
*
* @return array
*/
public function getVarsExport()
public function getConfigVarsExport()
{
return [];
}
Expand All @@ -152,7 +152,7 @@ public function getVarsExport()
*
* @return array
*/
public function getCfgsExport()
public function getConfigCfgsExport()
{
return [];
}
Expand All @@ -162,7 +162,7 @@ public function getCfgsExport()
*
* @return array
*/
public function getPlaceholdersExport()
public function getConfigPlaceholdersExport()
{
return [];
}
Expand Down
6 changes: 3 additions & 3 deletions modules/cms/tests/src/base/BlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testBlockSetup()
$this->assertEquals('TestBlock.twig', $block->getViewFileName('twig'));
$this->assertEquals('twig-frontend', $block->renderFrontend());

foreach ($block->getVarsExport() as $var) {
foreach ($block->getConfigVarsExport() as $var) {
$this->assertArrayHasKey('id', $var);
$this->assertArrayHasKey('var', $var);
$this->assertArrayHasKey('label', $var);
Expand All @@ -67,7 +67,7 @@ public function testBlockSetup()
$this->assertArrayHasKey('initvalue', $var);
}

foreach ($block->getCfgsExport() as $var) {
foreach ($block->getConfigCfgsExport() as $var) {
$this->assertArrayHasKey('id', $var);
$this->assertArrayHasKey('var', $var);
$this->assertArrayHasKey('label', $var);
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testBlockConfigException()
{
$block = new FailureBlock();
// will throw Exception: Required attributes in config var element is missing. var, label and type are required.
$block->getVarsExport();
$block->getConfigVarsExport();
}

public function testGetterSetter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testBasicInjector()
$injector = new ActiveQueryCheckboxInjector(['query' => NavItem::find(), 'varName' => 'test', 'varLabel' => 'test label', 'context' => $block]);
$injector->setup();

$vars = $block->getVarsExport();
$vars = $block->getConfigVarsExport();

$v = $vars[0];

Expand All @@ -50,7 +50,7 @@ public function testFieldSelectionBasicInjector()
$injector = new ActiveQueryCheckboxInjector(['query' => NavItem::find()->select(['title']), 'varName' => 'test', 'varLabel' => 'test label', 'context' => $block]);
$injector->setup();

$vars = $block->getVarsExport();
$vars = $block->getConfigVarsExport();

$v = $vars[0];

Expand Down

0 comments on commit 646a81d

Please sign in to comment.