Skip to content

Commit

Permalink
Adding ArrayInput trait. Add spaces for contantination. Fix the bug w…
Browse files Browse the repository at this point in the history
…ith missing default_code (#3743)
  • Loading branch information
LOBsTerr authored and jmolivas committed Jan 25, 2018
1 parent 281b4e8 commit 0b6f4c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Command/Generate/PluginBlockCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Drupal\Console\Command\Generate;

use Drupal\Console\Command\Shared\ArrayInputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -26,6 +27,7 @@

class PluginBlockCommand extends ContainerAwareCommand
{
use ArrayInputTrait;
use ServicesTrait;
use ModuleTrait;
use FormTrait;
Expand Down
4 changes: 2 additions & 2 deletions src/Extension/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function validateModuleFunctionExist($moduleName, $function, $moduleFile
$module = $this->getModule($moduleName);
$modulePath = $module->getPath();
if ($moduleFile) {
$this->site->loadLegacyFile($modulePath . '/'. $moduleFile);
$this->site->loadLegacyFile($modulePath . '/' . $moduleFile);
} else {
$this->site->loadLegacyFile($modulePath . '/' . $module->getName() . '.module');
}
Expand All @@ -352,7 +352,7 @@ public function getPluginPath($moduleName, $pluginType)
{
$module = $this->getModule($moduleName);

return $module->getPath() . '/src/Plugin/'.$pluginType;
return $module->getPath() . '/src/Plugin/' . $pluginType;
}

public function getDrupalExtension($type, $name)
Expand Down
4 changes: 3 additions & 1 deletion templates/module/src/Plugin/Block/block.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements
public function defaultConfiguration() {
return [
{% for input in inputs %}
'{{ input.name }}' => {{ input.default_code }},
{% if input.default_value is defined and input.default_value|length %}
'{{ input.name }}' => {{ input.default_value }},
{% endif %}
{% endfor %}
] + parent::defaultConfiguration();
}
Expand Down

0 comments on commit 0b6f4c4

Please sign in to comment.