Skip to content
Permalink
Browse files

Add warning that hook already exists, remove useless use statements, …

…add append flag for module.views.inc file (#3814)
  • Loading branch information...
LOBsTerr authored and jmolivas committed Apr 22, 2018
1 parent 1b95086 commit 39170921d1ab0c5ae07b11414407130b6fe07674
@@ -130,12 +130,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$class_machine_name = $this->stringConverter->camelCaseToUnderscore($class_name);
$title = $input->getOption('title');
$description = $input->getOption('description');
$function = $module . '_views_data';
$viewsFile = $module . '.views.inc';
if ($this->extensionManager->validateModuleFunctionExist($module, $function, $viewsFile)) {
$this->getIo()->warning(
sprintf(
$this->trans('commands.generate.plugin.views.field.messages.views-data-already-implemented'),
$module
)
);
}
$this->generator->generate([
'module' => $module,
'class_machine_name' => $class_machine_name,
@@ -39,7 +39,8 @@ public function generate(array $parameters)
$this->renderFile(
'module/module.views.inc.twig',
$this->extensionManager->getModule($module)->getPath() . '/' . $module . '.views.inc',
$parameters
$parameters,
FILE_APPEND
);
$this->renderFile(
@@ -4,16 +4,6 @@

{% block extra_info %} * Provide a custom views field data that isn't tied to any other module.{% endblock %}

{% block use_class %}
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Render\Markup;
use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\system\ActionConfigEntityInterface;
{% endblock %}

{% block file_methods %}
/**
* Implements hook_views_data().

0 comments on commit 3917092

Please sign in to comment.
You can’t perform that action at this time.