├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE ├── .gitignore ├── .php_cs ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── Test ├── BaseTestCase.php ├── Command │ ├── Generate │ │ └── ServiceCommandTest.php │ ├── GenerateCommandTest.php │ ├── GenerateEntityBundleCommandTest.php │ ├── GeneratorAuthenticationProviderCommandTest.php │ ├── GeneratorCommandCommandTest.php │ ├── GeneratorConfigFormBaseCommandTest.php │ ├── GeneratorControllerCommandTest.php │ ├── GeneratorEntityCommandTest.php │ ├── GeneratorEntityConfigCommandTest.php │ ├── GeneratorEntityContentCommandTest.php │ ├── GeneratorFormCommandTest.php │ ├── GeneratorJsTestCommandTest.php │ ├── GeneratorModuleCommandTest.php │ ├── GeneratorPermissionCommandTest.php │ ├── GeneratorPluginBlockCommandTest.php │ ├── GeneratorPluginConditionCommandTest.php │ ├── GeneratorPluginFieldCommandTest.php │ ├── GeneratorPluginFieldFormatterCommandTest.php │ ├── GeneratorPluginFieldTypeCommandTest.php │ ├── GeneratorPluginFieldWidgetCommandTest.php │ ├── GeneratorPluginImageEffectCommandTest.php │ ├── GeneratorPluginImageFormatterCommandTest.php │ ├── GeneratorPluginRestResourceCommandTest.php │ ├── GeneratorPluginRulesActionCommandTest.php │ ├── GeneratorPluginTypeAnnotationCommandTest.php │ ├── GeneratorPluginTypeYamlCommandTest.php │ └── GeneratorThemeCommandTest.php ├── DataProvider │ ├── AuthenticationProviderDataProviderTrait.php │ ├── CommandDataProviderTrait.php │ ├── ConfigFormBaseDataProviderTrait.php │ ├── ControllerDataProviderTrait.php │ ├── EntityBundleDataProviderTrait.php │ ├── EntityConfigDataProviderTrait.php │ ├── EntityContentDataProviderTrait.php │ ├── EntityDataProviderTrait.php │ ├── FormDataProviderTrait.php │ ├── JsTestDataProviderTrait.php │ ├── ModuleDataProviderTrait.php │ ├── PermissionDataProviderTrait.php │ ├── PluginBlockDataProviderTrait.php │ ├── PluginCKEditorButtonDataProviderTrait.php │ ├── PluginConditionDataProviderTrait.php │ ├── PluginFieldDataProviderTrait.php │ ├── PluginFieldFormatterDataProviderTrait.php │ ├── PluginFieldTypeDataProviderTrait.php │ ├── PluginFieldWidgetDataProviderTrait.php │ ├── PluginImageEffectDataProviderTrait.php │ ├── PluginImageFormatterDataProviderTrait.php │ ├── PluginRestResourceDataProviderTrait.php │ ├── PluginRulesActionDataProviderTrait.php │ ├── PluginTypeAnnotationDataProviderTrait.php │ ├── PluginTypeYamlDataProviderTrait.php │ ├── ProfileDataProviderTrait.php │ ├── ServiceDataProviderTrait.php │ └── ThemeDataProviderTrait.php ├── Generator │ ├── AuthenticationProviderGeneratorTest.php │ ├── CommandGeneratorTest.php │ ├── ConfigFormBaseGeneratorTest.php │ ├── ContentTypeGeneratorTest.php │ ├── ControllerGeneratorTest.php │ ├── EntityConfigGeneratorTest.php │ ├── EntityContentGeneratorTest.php │ ├── EntityGeneratorTest.php │ ├── FormGeneratorTest.php │ ├── GeneratorTest.php │ ├── JsTestGeneratorTest.php │ ├── ModuleGeneratorTest.php │ ├── PermissionGeneratorTest.php │ ├── PluginBlockGeneratorTest.php │ ├── PluginCKEditorButtonGeneratorTest.php │ ├── PluginConditionGeneratorTest.php │ ├── PluginFieldFormatterGeneratorTest.php │ ├── PluginFieldGeneratorTest.php │ ├── PluginFieldTypeGeneratorTest.php │ ├── PluginFieldWidgetGeneratorTest.php │ ├── PluginImageEffectGeneratorTest.php │ ├── PluginImageFormatterGeneratorTest.php │ ├── PluginRestResourceGeneratorTest.php │ ├── PluginRulesActionGeneratorTest.php │ ├── PluginTypeAnnotationGeneratorTest.php │ ├── PluginTypeYamlGeneratorTest.php │ ├── ProfileGeneratorTest.php │ ├── ServiceGeneratorTest.php │ └── ThemeGeneratorTest.php └── Helper │ └── StringHelperTest.php ├── autoload.local.php.dist ├── autoload.php.dist ├── bin ├── drupal ├── drupal.bat └── drupal.php ├── box.json ├── composer.json ├── config └── services │ ├── cache.yml │ ├── config.yml │ ├── create.yml │ ├── cron.yml │ ├── database.yml │ ├── debug.yml │ ├── entity.yml │ ├── feature.yml │ ├── field.yml │ ├── generate.yml │ ├── generator.yml │ ├── image.yml │ ├── locale.yml │ ├── migrate.yml │ ├── misc.yml │ ├── module.yml │ ├── multisite.yml │ ├── node.yml │ ├── queue.yml │ ├── rest.yml │ ├── role.yml │ ├── router.yml │ ├── simpletest.yml │ ├── site.yml │ ├── state.yml │ ├── taxonomy.yml │ ├── theme.yml │ ├── update.yml │ ├── user.yml │ └── views.yml ├── phpqa.yml ├── phpunit.xml.dist ├── resources ├── dash.css └── drupal-console.png ├── services.yml ├── src ├── Annotations │ ├── DrupalCommand.php │ └── DrupalCommandAnnotationReader.php ├── Application.php ├── Bootstrap │ ├── Drupal.php │ ├── DrupalCompilerPass.php │ ├── DrupalKernel.php │ ├── DrupalKernelTrait.php │ ├── DrupalServiceModifier.php │ ├── DrupalUpdateKernel.php │ ├── FindCommandsCompilerPass.php │ └── FindGeneratorsCompilerPass.php ├── Command │ ├── Cache │ │ ├── RebuildCommand.php │ │ └── TagInvalidateCommand.php │ ├── ComposerizeCommand.php │ ├── Config │ │ ├── DeleteCommand.php │ │ ├── DiffCommand.php │ │ ├── EditCommand.php │ │ ├── ExportCommand.php │ │ ├── ExportContentTypeCommand.php │ │ ├── ExportEntityCommand.php │ │ ├── ExportSingleCommand.php │ │ ├── ExportViewCommand.php │ │ ├── ImportCommand.php │ │ ├── ImportSingleCommand.php │ │ ├── OverrideCommand.php │ │ ├── PrintConfigValidationTrait.php │ │ └── ValidateCommand.php │ ├── Create │ │ ├── CommentsCommand.php │ │ ├── NodesCommand.php │ │ ├── RolesCommand.php │ │ ├── TermsCommand.php │ │ ├── UsersCommand.php │ │ └── VocabulariesCommand.php │ ├── Cron │ │ ├── ExecuteCommand.php │ │ └── ReleaseCommand.php │ ├── Database │ │ ├── AddCommand.php │ │ ├── ClientCommand.php │ │ ├── ConnectCommand.php │ │ ├── DatabaseLogBase.php │ │ ├── DropCommand.php │ │ ├── DumpCommand.php │ │ ├── LogClearCommand.php │ │ ├── LogPollCommand.php │ │ ├── QueryCommand.php │ │ └── RestoreCommand.php │ ├── Debug │ │ ├── BreakpointsCommand.php │ │ ├── CacheContextCommand.php │ │ ├── ConfigCommand.php │ │ ├── ConfigSettingsCommand.php │ │ ├── ConfigValidateCommand.php │ │ ├── ContainerCommand.php │ │ ├── CronCommand.php │ │ ├── DatabaseLogCommand.php │ │ ├── DatabaseTableCommand.php │ │ ├── DotenvCommand.php │ │ ├── EntityCommand.php │ │ ├── EventCommand.php │ │ ├── FeaturesCommand.php │ │ ├── HookCommand.php │ │ ├── ImageStylesCommand.php │ │ ├── LibrariesCommand.php │ │ ├── MigrateCommand.php │ │ ├── ModuleCommand.php │ │ ├── MultisiteCommand.php │ │ ├── PermissionCommand.php │ │ ├── PluginCommand.php │ │ ├── QueueCommand.php │ │ ├── RestCommand.php │ │ ├── RolesCommand.php │ │ ├── RouterCommand.php │ │ ├── StateCommand.php │ │ ├── TestCommand.php │ │ ├── ThemeCommand.php │ │ ├── ThemeKeysCommand.php │ │ ├── UpdateCommand.php │ │ ├── UpdateComposerCommand.php │ │ ├── UserCommand.php │ │ ├── ViewsCommand.php │ │ └── ViewsPluginsCommand.php │ ├── DevelDumperCommand.php │ ├── DockerInitCommand.php │ ├── DotenvInitCommand.php │ ├── Entity │ │ └── DeleteCommand.php │ ├── Features │ │ └── ImportCommand.php │ ├── Field │ │ └── InfoCommand.php │ ├── Generate │ │ ├── AjaxCommand.php │ │ ├── AuthenticationProviderCommand.php │ │ ├── BlockTypeCommand.php │ │ ├── BreakPointCommand.php │ │ ├── CacheContextCommand.php │ │ ├── CommandCommand.php │ │ ├── ComposerCommand.php │ │ ├── ConfigFormBaseCommand.php │ │ ├── ControllerCommand.php │ │ ├── EntityBundleCommand.php │ │ ├── EntityCommand.php │ │ ├── EntityConfigCommand.php │ │ ├── EntityContentCommand.php │ │ ├── EventSubscriberCommand.php │ │ ├── FormAlterCommand.php │ │ ├── FormBaseCommand.php │ │ ├── FormCommand.php │ │ ├── HelpCommand.php │ │ ├── JsTestCommand.php │ │ ├── ModuleCommand.php │ │ ├── ModuleFileCommand.php │ │ ├── PermissionCommand.php │ │ ├── PluginBlockCommand.php │ │ ├── PluginCKEditorButtonCommand.php │ │ ├── PluginConditionCommand.php │ │ ├── PluginDerivativeCommand.php │ │ ├── PluginFieldCommand.php │ │ ├── PluginFieldFormatterCommand.php │ │ ├── PluginFieldTypeCommand.php │ │ ├── PluginFieldWidgetCommand.php │ │ ├── PluginImageEffectCommand.php │ │ ├── PluginImageFormatterCommand.php │ │ ├── PluginMailCommand.php │ │ ├── PluginMigrateDataParserCommand.php │ │ ├── PluginMigrateProcessCommand.php │ │ ├── PluginMigrateSourceCommand.php │ │ ├── PluginQueueWorkerCommand.php │ │ ├── PluginRestResourceCommand.php │ │ ├── PluginRulesActionCommand.php │ │ ├── PluginRulesConditionCommand.php │ │ ├── PluginRulesDataprocessorCommand.php │ │ ├── PluginSkeletonCommand.php │ │ ├── PluginTypeAnnotationCommand.php │ │ ├── PluginTypeYamlCommand.php │ │ ├── PluginValidationConstraintCommand.php │ │ ├── PluginViewsFieldCommand.php │ │ ├── PostUpdateCommand.php │ │ ├── ProfileCommand.php │ │ ├── RouteSubscriberCommand.php │ │ ├── ServiceCommand.php │ │ ├── ThemeCommand.php │ │ ├── ThemeSettingCommand.php │ │ ├── TwigExtensionCommand.php │ │ └── UpdateCommand.php │ ├── Image │ │ └── StylesFlushCommand.php │ ├── Locale │ │ ├── LanguageAddCommand.php │ │ ├── LanguageDeleteCommand.php │ │ └── TranslationStatusCommand.php │ ├── Migrate │ │ ├── ExecuteCommand.php │ │ ├── RollBackCommand.php │ │ └── SetupCommand.php │ ├── Module │ │ ├── DownloadCommand.php │ │ ├── InstallCommand.php │ │ ├── InstallDependencyCommand.php │ │ ├── PathCommand.php │ │ ├── UninstallCommand.php │ │ └── UpdateCommand.php │ ├── Multisite │ │ ├── NewCommand.php │ │ └── UpdateCommand.php │ ├── Node │ │ └── AccessRebuildCommand.php │ ├── Queue │ │ └── RunCommand.php │ ├── Rest │ │ ├── DisableCommand.php │ │ └── EnableCommand.php │ ├── Role │ │ ├── DeleteCommand.php │ │ └── NewCommand.php │ ├── Router │ │ └── RebuildCommand.php │ ├── ServerCommand.php │ ├── Service │ │ └── OverrideCommand.php │ ├── Shared │ │ ├── ArrayInputTrait.php │ │ ├── ConfirmationTrait.php │ │ ├── ConnectTrait.php │ │ ├── CreateTrait.php │ │ ├── DatabaseTrait.php │ │ ├── EventsTrait.php │ │ ├── ExportTrait.php │ │ ├── ExtensionTrait.php │ │ ├── FeatureTrait.php │ │ ├── FormTrait.php │ │ ├── LocaleTrait.php │ │ ├── MenuTrait.php │ │ ├── MigrationTrait.php │ │ ├── ModuleTrait.php │ │ ├── PermissionTrait.php │ │ ├── ProjectDownloadTrait.php │ │ ├── RestTrait.php │ │ ├── ServicesTrait.php │ │ ├── ThemeBreakpointTrait.php │ │ ├── ThemeRegionTrait.php │ │ ├── ThemeTrait.php │ │ ├── TranslationTrait.php │ │ └── UpdateTrait.php │ ├── ShellCommand.php │ ├── Site │ │ ├── ImportLocalCommand.php │ │ ├── InstallCommand.php │ │ ├── MaintenanceCommand.php │ │ ├── ModeCommand.php │ │ ├── StatisticsCommand.php │ │ └── StatusCommand.php │ ├── SnippetCommand.php │ ├── State │ │ ├── DeleteCommand.php │ │ └── OverrideCommand.php │ ├── Taxonomy │ │ └── DeleteTermCommand.php │ ├── Test │ │ └── RunCommand.php │ ├── Theme │ │ ├── DownloadCommand.php │ │ ├── InstallCommand.php │ │ ├── PathCommand.php │ │ ├── ThemeBaseCommand.php │ │ └── UninstallCommand.php │ ├── Update │ │ ├── EntitiesCommand.php │ │ └── ExecuteCommand.php │ ├── User │ │ ├── CreateCommand.php │ │ ├── DeleteCommand.php │ │ ├── LoginCleanAttemptsCommand.php │ │ ├── LoginUrlCommand.php │ │ ├── PasswordHashCommand.php │ │ ├── PasswordResetCommand.php │ │ ├── RoleCommand.php │ │ ├── UnblockCommand.php │ │ └── UserBase.php │ └── Views │ │ ├── DisableCommand.php │ │ └── EnableCommand.php ├── Extension │ ├── Discovery.php │ ├── Extension.php │ └── Manager.php ├── Generator │ ├── AjaxCommandGenerator.php │ ├── AuthenticationProviderGenerator.php │ ├── BlockTypeGenerator.php │ ├── BreakPointGenerator.php │ ├── CacheContextGenerator.php │ ├── CommandGenerator.php │ ├── ComposerGenerator.php │ ├── ControllerGenerator.php │ ├── DatabaseSettingsGenerator.php │ ├── DockerInitGenerator.php │ ├── DotenvInitGenerator.php │ ├── EntityBundleGenerator.php │ ├── EntityConfigGenerator.php │ ├── EntityContentGenerator.php │ ├── EventSubscriberGenerator.php │ ├── FormAlterGenerator.php │ ├── FormGenerator.php │ ├── HelpGenerator.php │ ├── JsTestGenerator.php │ ├── ModuleFileGenerator.php │ ├── ModuleGenerator.php │ ├── PermissionGenerator.php │ ├── PluginBlockGenerator.php │ ├── PluginCKEditorButtonGenerator.php │ ├── PluginConditionGenerator.php │ ├── PluginDerivativeGenerator.php │ ├── PluginFieldFormatterGenerator.php │ ├── PluginFieldTypeGenerator.php │ ├── PluginFieldWidgetGenerator.php │ ├── PluginImageEffectGenerator.php │ ├── PluginImageFormatterGenerator.php │ ├── PluginMailGenerator.php │ ├── PluginMigrateDataParserGenerator.php │ ├── PluginMigrateProcessGenerator.php │ ├── PluginMigrateSourceGenerator.php │ ├── PluginQueueWorkerGenerator.php │ ├── PluginRestResourceGenerator.php │ ├── PluginRulesActionGenerator.php │ ├── PluginRulesConditionGenerator.php │ ├── PluginRulesDataprocessorGenerator.php │ ├── PluginSkeletonGenerator.php │ ├── PluginTypeAnnotationGenerator.php │ ├── PluginTypeYamlGenerator.php │ ├── PluginValidationConstraintGenerator.php │ ├── PluginViewsFieldGenerator.php │ ├── PostUpdateGenerator.php │ ├── ProfileGenerator.php │ ├── RouteSubscriberGenerator.php │ ├── ServiceGenerator.php │ ├── ThemeGenerator.php │ ├── ThemeSettingGenerator.php │ ├── TwigExtensionGenerator.php │ └── UpdateGenerator.php ├── Override │ └── ConfigSubscriber.php ├── Plugin │ └── ScriptHandler.php ├── Utils │ ├── AnnotationValidator.php │ ├── Create │ │ ├── Base.php │ │ ├── CommentData.php │ │ ├── NodeData.php │ │ ├── RoleData.php │ │ ├── TermData.php │ │ ├── UserData.php │ │ └── VocabularyData.php │ ├── DrupalApi.php │ ├── MigrateExecuteMessageCapture.php │ ├── Site.php │ ├── TranslatorManager.php │ └── Validator.php └── Zippy │ ├── Adapter │ └── TarGzGNUTarForWindowsAdapter.php │ └── FileStrategy │ └── TarGzFileForWindowsStrategy.php ├── templates ├── base │ ├── class.php.twig │ ├── file.php.twig │ └── interface.php.twig ├── core │ └── translation │ │ └── stats.md.twig ├── database │ ├── add-default.php.twig │ └── add.php.twig ├── files │ ├── .env.dist.twig │ ├── .gitignore.dist │ ├── docker-compose.yml.twig │ └── settings.php.twig ├── module │ ├── Tests │ │ └── Controller │ │ │ └── controller.php.twig │ ├── composer.json.twig │ ├── config │ │ ├── install │ │ │ └── field.default.yml.twig │ │ └── schema │ │ │ └── entity.schema.yml.twig │ ├── entity-content-page.php.twig │ ├── features.yml.twig │ ├── help.php.twig │ ├── info.yml.twig │ ├── js │ │ └── commands.php.twig │ ├── links.action-entity-content.yml.twig │ ├── links.action-entity.yml.twig │ ├── links.menu-entity-config.yml.twig │ ├── links.menu-entity-content.yml.twig │ ├── links.menu.yml.twig │ ├── links.task-entity-content.yml.twig │ ├── module-block-twig-template-append.twig │ ├── module-file.twig │ ├── module-libraries.yml.twig │ ├── module-twig-template-append.twig │ ├── module.twig │ ├── module.views.inc.twig │ ├── permission-routing.yml.twig │ ├── permission.yml.twig │ ├── permissions-entity-content.yml.twig │ ├── php_tag.php.twig │ ├── plugin-annotation-services.yml.twig │ ├── plugin-yaml-services.yml.twig │ ├── plugin.yml.twig │ ├── post-update.php.twig │ ├── routing-controller.yml.twig │ ├── routing-form.yml.twig │ ├── schema.yml.twig │ ├── services.yml.twig │ ├── src │ │ ├── Ajax │ │ │ └── ajax-command.php.twig │ │ ├── Annotation │ │ │ └── plugin-type.php.twig │ │ ├── Authentication │ │ │ └── Provider │ │ │ │ └── authentication-provider.php.twig │ │ ├── Command │ │ │ ├── command.php.twig │ │ │ └── console │ │ │ │ └── translations │ │ │ │ └── en │ │ │ │ └── command.yml.twig │ │ ├── Controller │ │ │ ├── controller.php.twig │ │ │ └── entity-controller.php.twig │ │ ├── Entity │ │ │ ├── Bundle │ │ │ │ ├── core.entity_form_display.node.default.yml.twig │ │ │ │ ├── core.entity_view_display.node.default.yml.twig │ │ │ │ ├── core.entity_view_display.node.teaser.yml.twig │ │ │ │ ├── entity-bundle-field-info-alter.php.twig │ │ │ │ ├── field.field.node.body.yml.twig │ │ │ │ └── node.type.yml.twig │ │ │ ├── Form │ │ │ │ ├── entity-content-delete.php.twig │ │ │ │ ├── entity-content-revision-delete.php.twig │ │ │ │ ├── entity-content-revision-revert-translation.php.twig │ │ │ │ ├── entity-content-revision-revert.php.twig │ │ │ │ ├── entity-content.php.twig │ │ │ │ └── entity-settings.php.twig │ │ │ ├── entity-content-views-data.php.twig │ │ │ ├── entity-content-with-bundle.theme.php.twig │ │ │ ├── entity-content-with-bundle.theme_hook_suggestions.php.twig │ │ │ ├── entity-content.php.twig │ │ │ ├── entity-content.theme.php.twig │ │ │ ├── entity.php.twig │ │ │ ├── interface-entity-content.php.twig │ │ │ └── interface-entity.php.twig │ │ ├── Form │ │ │ ├── entity-delete.php.twig │ │ │ ├── entity.php.twig │ │ │ ├── form-alter.php.twig │ │ │ ├── form-config.php.twig │ │ │ └── form.php.twig │ │ ├── Generator │ │ │ └── generator.php.twig │ │ ├── Plugin │ │ │ ├── Block │ │ │ │ ├── block.php.twig │ │ │ │ ├── block_derivative.php.twig │ │ │ │ └── blocktype.php.twig │ │ │ ├── CKEditorPlugin │ │ │ │ ├── ckeditorbutton.php.twig │ │ │ │ └── plugin.php.twig │ │ │ ├── Condition │ │ │ │ ├── condition.php.twig │ │ │ │ └── rulescondition.php.twig │ │ │ ├── Derivative │ │ │ │ └── derivative_block_derivative.php.twig │ │ │ ├── Field │ │ │ │ ├── FieldFormatter │ │ │ │ │ ├── fieldformatter.php.twig │ │ │ │ │ └── imageformatter.php.twig │ │ │ │ ├── FieldType │ │ │ │ │ └── fieldtype.php.twig │ │ │ │ └── FieldWidget │ │ │ │ │ └── fieldwidget.php.twig │ │ │ ├── ImageEffect │ │ │ │ └── imageeffect.php.twig │ │ │ ├── Mail │ │ │ │ └── mail.php.twig │ │ │ ├── QueueWorker │ │ │ │ └── queue_worker.php.twig │ │ │ ├── Rest │ │ │ │ └── Resource │ │ │ │ │ └── rest.php.twig │ │ │ ├── RulesAction │ │ │ │ └── rulesaction.php.twig │ │ │ ├── RulesDataProcessor │ │ │ │ └── rulesdataprocessor.php.twig │ │ │ ├── Validation │ │ │ │ └── Constraint │ │ │ │ │ ├── constraint.php.twig │ │ │ │ │ └── validator.php.twig │ │ │ ├── Views │ │ │ │ └── field │ │ │ │ │ └── field.php.twig │ │ │ ├── migrate │ │ │ │ ├── process │ │ │ │ │ └── process.php.twig │ │ │ │ └── source │ │ │ │ │ └── source.php.twig │ │ │ ├── migrate_plus │ │ │ │ └── data_parser │ │ │ │ │ └── data_parser.php.twig │ │ │ └── skeleton.php.twig │ │ ├── Routing │ │ │ └── route-subscriber.php.twig │ │ ├── Tests │ │ │ ├── js-test.php.twig │ │ │ └── load-test.php.twig │ │ ├── TwigExtension │ │ │ └── twig-extension.php.twig │ │ ├── accesscontrolhandler-entity-content.php.twig │ │ ├── cache-context.php.twig │ │ ├── entity-content-bundle-permissions.php.twig │ │ ├── entity-content-route-provider.php.twig │ │ ├── entity-listbuilder.php.twig │ │ ├── entity-route-provider.php.twig │ │ ├── entity-storage.php.twig │ │ ├── entity-translation-handler.php.twig │ │ ├── event-subscriber.php.twig │ │ ├── interface-entity-storage.php.twig │ │ ├── listbuilder-entity-content.php.twig │ │ ├── plugin-type-annotation-base.php.twig │ │ ├── plugin-type-annotation-interface.php.twig │ │ ├── plugin-type-annotation-manager.php.twig │ │ ├── service-interface.php.twig │ │ ├── service.php.twig │ │ ├── yaml-plugin-manager-interface.php.twig │ │ └── yaml-plugin-manager.php.twig │ ├── templates │ │ ├── entity-html.twig │ │ ├── entity-with-bundle-content-add-list-html.twig │ │ └── plugin-block-html.twig │ ├── twig-template-file.twig │ └── update.php.twig ├── profile │ ├── info.yml.twig │ ├── install.twig │ └── profile.twig └── theme │ ├── breakpoints.yml.twig │ ├── info.yml.twig │ ├── libraries.yml.twig │ └── theme.twig └── uninstall.services.yml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # [jmolivas] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: drupalconsole 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | ### Issue title 2 | 3 | The issue title should comply with the following structure: 4 | 5 | [ *ISSUE-GROUP* ] Short description 6 | 7 | The *ISSUE-GROUP* should be one of: 8 | 9 | * `command:name` 10 | * `console` 11 | * `helper` 12 | * `standard` 13 | * `template` 14 | * `translation` 15 | * `test` 16 | * `docs` 17 | 18 | ### Problem/Motivation 19 | A brief statement describing why the issue was filed. 20 | 21 | **Details to include:** 22 | - Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences. 23 | 24 | ### How to reproduce 25 | Include steps related how to reproduce. 26 | 27 | **Details to include:** 28 | - Drupal version (you can obtain this by running `drupal site:status`). 29 | - Console version (you can obtain this by running `composer show | grep drupal/console`). 30 | - Console Launcher version (you can obtain this by running outside of a drupal site `drupal --version`). 31 | - Steps to reproduce 32 | - Include screen-shot or video whenever necessary. 33 | 34 | ### Solution 35 | A brief description of the proposed fix. 36 | 37 | **Details to include:** 38 | - A short summary of the approach proposed or used in the PR. 39 | - Approaches that have been tried and ruled out. 40 | - Links to relevant API documentation or other resources. 41 | - Known workarounds. 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # deprecation-detector 2 | /.rules 3 | 4 | # Composer 5 | composer.lock 6 | /vendor 7 | /bin/phpunit 8 | /bin/jsonlint 9 | /bin/phpcbf 10 | /bin/phpcs 11 | /bin/validate-json 12 | /bin/pdepend 13 | /bin/php-cs-fixer 14 | /bin/phpmd 15 | /bin/php-parse 16 | /bin/psysh 17 | PATCHES.txt 18 | 19 | # Develop 20 | autoload.local.php 21 | 22 | # Binaries 23 | /box.phar 24 | /console.phar 25 | /drupal.phar 26 | /drupal.phar.version 27 | 28 | # Test 29 | /phpunit.xml 30 | 31 | # Drupal 32 | /core 33 | /nbproject/ 34 | 35 | # drupal/console-extend-plugin generated files 36 | extend.console.*.yml 37 | *-console.services.yml 38 | 39 | #PhpStorm 40 | .idea/* 41 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | setRules( 5 | [ 6 | '@PSR2' => true, 7 | 'array_syntax' => ['syntax' => 'short'], 8 | ] 9 | ) 10 | ->setUsingCache(false); 11 | -------------------------------------------------------------------------------- /Test/Command/GenerateCommandTest.php: -------------------------------------------------------------------------------- 1 | set('twig', new \Twig_Environment()); 17 | return $container; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Test/Command/GeneratorAuthenticationProviderCommandTest.php: -------------------------------------------------------------------------------- 1 | getHelperSet()); 30 | $command->setHelperSet($this->getHelperSet()); 31 | $command->setGenerator($this->getGenerator()); 32 | 33 | $commandTester = new CommandTester($command); 34 | 35 | $code = $commandTester->execute( 36 | [ 37 | '--module' => $module, 38 | '--class' => $class 39 | ], 40 | ['interactive' => false] 41 | ); 42 | 43 | $this->assertEquals(0, $code); 44 | } 45 | 46 | private function getGenerator() 47 | { 48 | return $this 49 | ->getMockBuilder('Drupal\Console\Generator\AuthenticationProviderGenerator') 50 | ->disableOriginalConstructor() 51 | ->setMethods(['generate']) 52 | ->getMock(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Test/Command/GeneratorJsTestCommandTest.php: -------------------------------------------------------------------------------- 1 | getHelperSet()); 31 | $command->setHelperSet($this->getHelperSet()); 32 | $command->setGenerator($this->getGenerator()); 33 | 34 | $commandTester = new CommandTester($command); 35 | 36 | $code = $commandTester->execute( 37 | [ 38 | '--module' => $module, 39 | '--class' => $class_name, 40 | ], 41 | ['interactive' => false] 42 | ); 43 | 44 | $this->assertEquals(0, $code); 45 | } 46 | 47 | private function getGenerator() 48 | { 49 | return $this 50 | ->getMockBuilder('Drupal\Console\Generator\JsTestGenerator') 51 | ->disableOriginalConstructor() 52 | ->setMethods(['generate']) 53 | ->getMock(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Test/Command/GeneratorPermissionCommandTest.php: -------------------------------------------------------------------------------- 1 | getHelperSet()); 30 | $command->setHelperSet($this->getHelperSet()); 31 | $command->setGenerator($this->getGenerator()); 32 | 33 | $commandTester = new CommandTester($command); 34 | 35 | $code = $commandTester->execute( 36 | [ 37 | '--module' => $module, 38 | '--permissions' => $permissions, 39 | ], 40 | ['interactive' => false] 41 | ); 42 | 43 | $this->assertEquals(0, $code); 44 | } 45 | 46 | private function getGenerator() 47 | { 48 | return $this 49 | ->getMockBuilder('Drupal\Console\Generator\PermissionGenerator') 50 | ->disableOriginalConstructor() 51 | ->setMethods(['generate']) 52 | ->getMock(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Test/DataProvider/AuthenticationProviderDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 0], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/CommandDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['command_' . rand(), 'command:default', 'CommandDefault', false], 20 | ['command_' . rand(), 'command:default', 'CommandDefault', true] 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Test/DataProvider/ConfigFormBaseDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Bar', null, null, 'ConfigFormBase', null, true, 'Foo', 'system.admin_config_development', 'foo'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/ControllerDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | $routes = [ 19 | ['title' => 'Foo Controller', 'name' => 'custom.default_controller_hello', 'method' => 'index', 'path' => '/hello/{name}'] 20 | ]; 21 | 22 | return [ 23 | ['foo', 'FooController', $routes, true, null, 'foo_controller'], 24 | ['foo', 'FooController', $routes, false, null, 'foo_controller'], 25 | ]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Test/DataProvider/EntityBundleDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['foo', 'default_type', 'default'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/EntityConfigDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Bar', '', 'bar', 'admin/structure'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/EntityContentDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Bar', 'bar', 'admin/structure', 'true', true], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/EntityDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'Bar', 'foo' . rand(), 'bar', 'admin/structure'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/FormDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'id' . rand(), null, null, 'FormBase', '/form/path', true, 'foo', 'system.admin_config_development', 'foo'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/JsTestDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['foo', 'JsFooTest'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/ModuleDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', true, '', false, null], 20 | ['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', false, 'default', false, null], 21 | ['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', true, '', false, null], 22 | ['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', false, '', false, null], 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Test/DataProvider/PermissionDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'my permissions'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginBlockDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'bar', null, '', 'inputs'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginCKEditorButtonDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'bar', 'Baz', 'foo/js/pluggin/bar/images/icon.png'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginConditionDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'bar-id', 'foo-context-id', 'foo-context-label', false] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginFieldDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar', 'foo-bar', 'foo-bar', 'bar'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginFieldFormatterDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'bar', 'bar' . rand(), 'foo-bar'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginFieldTypeDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginFieldWidgetDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'Foo-Bar'] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginImageEffectDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'bar', 'description'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginImageFormatterDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'foo', 'bar'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginRestResourceDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Foo', 'pluginID' . rand(), 'url', 'states'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginRulesActionDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Foo', 'pluginID' . rand(), 'category', 'context', 'bar'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginTypeAnnotationDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'MyPlugin', 'my_plugin', 'my.plugin'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/PluginTypeYamlDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'MyPlugin', 'my_plugin', 'my.plugin'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/ProfileDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | // Profile name, machine name, description, core version, 20 | // dependencies, distribution name. 21 | ['Foo', 'foo' . rand(), $this->dir . '/profiles', 'Description', '8.x', null, false], 22 | ['Foo', 'foo' . rand(), $this->dir . '/profiles', 'Description', '8.x', null, 'Bar'], 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Test/DataProvider/ServiceDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', 'foo' . rand(), 'Foo', false, [],'default'], 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/DataProvider/ThemeDataProviderTrait.php: -------------------------------------------------------------------------------- 1 | setUpTemporaryDirectory(); 17 | 18 | return [ 19 | ['Foo', rand(), $this->dir.'/themes/custom', 'bar', 'Other', '8.x', 'sd', 'global-styling', false, false] 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Test/Generator/AuthenticationProviderGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 32 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 33 | $generator->setHelperSet($this->getHelperSet()); 34 | 35 | $generator->generate( 36 | $module, 37 | $class_name, 38 | $provider_id 39 | ); 40 | 41 | $files = [ 42 | $generator->getSite()->getAuthenticationPath($module, 'Provider').'/'.$class_name.'.php', 43 | $generator->getSite()->getModulePath($module).'/'.$module.'.services.yml' 44 | ]; 45 | 46 | foreach ($files as $file) { 47 | $this->assertTrue( 48 | file_exists($file), 49 | sprintf('%s does not exist', $file) 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Test/Generator/CommandGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 33 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 34 | $generator->setHelperSet($this->getHelperSet()); 35 | 36 | $generator->generate( 37 | $module, 38 | $name, 39 | $class, 40 | $containerAware 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Test/Generator/GeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 31 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 32 | $generator->setHelperSet($this->getHelperSet()); 33 | 34 | $generator->generate( 35 | $module, 36 | $class_name 37 | ); 38 | 39 | $files = [ 40 | $generator->getSite()->getJsTestsPath($module) . "/$class_name.php", 41 | ]; 42 | 43 | foreach ($files as $file) { 44 | $this->assertTrue( 45 | file_exists($file), 46 | sprintf('%s does not exist', $file) 47 | ); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Test/Generator/PermissionGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 31 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 32 | $generator->setHelperSet($this->getHelperSet()); 33 | 34 | $generator->generate( 35 | $module, 36 | $permissions 37 | ); 38 | 39 | $this->assertTrue( 40 | file_exists($generator->getSite()->getModulePath($module).'/'.$module.'.permissions.yml'), 41 | sprintf('%s does not exist', $module.'.permissions.yml') 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Test/Generator/PluginBlockGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 39 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 40 | $generator->setHelperSet($this->getHelperSet()); 41 | 42 | $generator->generate( 43 | $module, 44 | $class_name, 45 | $label, 46 | $plugin_id, 47 | $services, 48 | $inputs 49 | ); 50 | 51 | $this->assertTrue( 52 | file_exists($generator->getSite()->getPluginPath($module, 'Block').'/'.$class_name.'.php'), 53 | sprintf('%s does not exist', $class_name.'.php') 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Test/Generator/PluginFieldFormatterGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 37 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 38 | $generator->setHelperSet($this->getHelperSet()); 39 | 40 | $generator->generate( 41 | $module, 42 | $class_name, 43 | $label, 44 | $plugin_id, 45 | $field_type 46 | ); 47 | 48 | $this->assertTrue( 49 | file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php'), 50 | sprintf('%s does not exist', $class_name.'.php') 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Test/Generator/PluginFieldWidgetGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 37 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 38 | $generator->setHelperSet($this->getHelperSet()); 39 | 40 | $generator->generate( 41 | $module, 42 | $class_name, 43 | $label, 44 | $plugin_id, 45 | $field_type 46 | ); 47 | 48 | $this->assertTrue( 49 | file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php'), 50 | sprintf('%s does not exist', $class_name.'.php') 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Test/Generator/PluginImageEffectGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 36 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 37 | $generator->setHelperSet($this->getHelperSet()); 38 | 39 | $generator->generate( 40 | $module, 41 | $class_name, 42 | $label, 43 | $plugin_id, 44 | $description 45 | ); 46 | 47 | $this->assertTrue( 48 | file_exists($generator->getSite()->getPluginPath($module, 'ImageEffect').'/'.$class_name.'.php'), 49 | sprintf('%s does not exist', $class_name.'.php') 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Test/Generator/PluginImageFormatterGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 34 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 35 | $generator->setHelperSet($this->getHelperSet()); 36 | 37 | $generator->generate( 38 | $module, 39 | $class_name, 40 | $label, 41 | $plugin_id 42 | ); 43 | 44 | $this->assertTrue( 45 | file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php'), 46 | sprintf('%s does not exist', $class_name.'.php') 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Test/Generator/PluginRestResourceGeneratorTest.php: -------------------------------------------------------------------------------- 1 | getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs()); 38 | $this->getRenderHelper()->setTranslator($this->getTranslatorHelper()); 39 | $generator->setHelperSet($this->getHelperSet()); 40 | 41 | $generator->generate( 42 | $module, 43 | $class_name, 44 | $plugin_label, 45 | $plugin_id, 46 | $plugin_url, 47 | $plugin_states 48 | ); 49 | 50 | $this->assertTrue( 51 | file_exists($generator->getSite()->getPluginPath($module, 'rest').'/resource/'.$class_name.'.php'), 52 | sprintf('%s does not exist', $class_name.'.php') 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Test/Helper/StringHelperTest.php: -------------------------------------------------------------------------------- 1 | stringHelper = new StringHelper(); 14 | } 15 | 16 | /** 17 | * @dataProvider getDataNames 18 | */ 19 | public function testCreateMachineName($input, $machine_name) 20 | { 21 | $this->assertEquals($this->stringHelper->createMachineName($input), $machine_name); 22 | } 23 | 24 | /** 25 | * @dataProvider getDataCamelCaseNames 26 | */ 27 | public function testCamelCaseToMachineName($camel_case, $machine_name) 28 | { 29 | $this->assertEquals($this->stringHelper->camelCaseToMachineName($camel_case), $machine_name); 30 | } 31 | 32 | /** 33 | * Random strings and their equivalent machine-name 34 | */ 35 | public function getDataNames() 36 | { 37 | return [ 38 | ['Test Space between words', 'test_space_between_words'], 39 | ['test$special*characters!', 'test_special_characters'], 40 | ['URL', 'url'], 41 | ]; 42 | } 43 | 44 | /** 45 | * Camel-case strings and their equivalent machine-name 46 | */ 47 | public function getDataCamelCaseNames() 48 | { 49 | return [ 50 | ['camelCase', 'camel_case'], 51 | ['greatestFunctionEverWritten', 'greatest_function_ever_written'], 52 | ['WakeUp', 'wake_up'], 53 | ]; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /autoload.local.php.dist: -------------------------------------------------------------------------------- 1 | setPsr4('Drupal\\Console\\Test\\', __DIR__ . '/Test'); 6 | 7 | return $loader; 8 | -------------------------------------------------------------------------------- /bin/drupal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 2 | 3 | 13 | 14 | 15 | 16 | Test 17 | 18 | 19 | 20 | 21 | 22 | ./ 23 | 24 | ./Test 25 | ./vendor 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /resources/drupal-console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hechoendrupal/drupal-console/5db610d8b7b44ecba1a8ccda76e3bc3242d54f04/resources/drupal-console.png -------------------------------------------------------------------------------- /src/Annotations/DrupalCommand.php: -------------------------------------------------------------------------------- 1 | null, 22 | 'extensionType' => null, 23 | 'dependencies' => [], 24 | 'bootstrap' => 'installed' 25 | ]; 26 | $reader = new AnnotationReader(); 27 | $drupalCommandAnnotation = $reader->getClassAnnotation( 28 | new \ReflectionClass($class), 29 | 'Drupal\\Console\\Annotations\\DrupalCommand' 30 | ); 31 | if ($drupalCommandAnnotation) { 32 | $annotation['extension'] = $drupalCommandAnnotation->extension?:null; 33 | $annotation['extensionType'] = $drupalCommandAnnotation->extensionType?:null; 34 | $annotation['dependencies'] = $drupalCommandAnnotation->dependencies?:[]; 35 | $annotation['bootstrap'] = $drupalCommandAnnotation->bootstrap?:'install'; 36 | } 37 | 38 | return $annotation; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Bootstrap/DrupalKernel.php: -------------------------------------------------------------------------------- 1 | root = $root; 48 | $this->commandTag = $serviceTag; 49 | $this->generatorTag = $generatorTag; 50 | $this->configuration = $configuration; 51 | } 52 | 53 | /** 54 | * @inheritdoc 55 | */ 56 | public function alter(ContainerBuilder $container) 57 | { 58 | $container->addCompilerPass( 59 | new DrupalCompilerPass($this->configuration) 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Bootstrap/DrupalUpdateKernel.php: -------------------------------------------------------------------------------- 1 | serviceTag = $serviceTag; 26 | } 27 | 28 | /** 29 | * @inheritdoc 30 | */ 31 | public function process(ContainerBuilder $container) 32 | { 33 | $taggedServices = $container->findTaggedServiceIds( 34 | $this->serviceTag 35 | ); 36 | 37 | foreach ($taggedServices as $id => $tags) { 38 | $container->getDefinition($id) 39 | ->addTag('persist'); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Bootstrap/FindGeneratorsCompilerPass.php: -------------------------------------------------------------------------------- 1 | serviceTag = $serviceTag; 26 | } 27 | 28 | /** 29 | * @inheritdoc 30 | */ 31 | public function process(ContainerBuilder $container) 32 | { 33 | $taggedServices = $container->findTaggedServiceIds( 34 | $this->serviceTag 35 | ); 36 | 37 | $generators = []; 38 | foreach ($taggedServices as $id => $tags) { 39 | $generators[] = $id; 40 | } 41 | 42 | $container->setParameter('drupal.generators', $generators); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Command/Config/PrintConfigValidationTrait.php: -------------------------------------------------------------------------------- 1 | getIo()->info($this->trans('commands.config.validate.messages.success')); 16 | return 0; 17 | } 18 | 19 | foreach ($valid as $key => $error) { 20 | $this->getIo()->warning($key . ': ' . $error); 21 | } 22 | return 1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Command/Debug/CronCommand.php: -------------------------------------------------------------------------------- 1 | moduleHandler = $moduleHandler; 30 | parent::__construct(); 31 | } 32 | 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | protected function configure() 37 | { 38 | $this 39 | ->setName('debug:cron') 40 | ->setDescription($this->trans('commands.debug.cron.description')) 41 | ->setAliases(['dcr']); 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | protected function execute(InputInterface $input, OutputInterface $output) 48 | { 49 | $this->getIo()->section( 50 | $this->trans('commands.debug.cron.messages.module-list') 51 | ); 52 | 53 | $this->getIo()->table( 54 | [ $this->trans('commands.debug.cron.messages.module') ], 55 | $this->moduleHandler->getImplementations('cron'), 56 | 'compact' 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Command/Debug/DotenvCommand.php: -------------------------------------------------------------------------------- 1 | drupalFinder = $drupalFinder; 32 | parent::__construct(); 33 | } 34 | 35 | protected function configure() 36 | { 37 | $this->setName('debug:dotenv') 38 | ->setDescription('Debug Dotenv debug values.'); 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | protected function execute(InputInterface $input, OutputInterface $output) 45 | { 46 | $fs = new Filesystem(); 47 | $envFile = $this->drupalFinder->getComposerRoot() . '/.env'; 48 | if (!$fs->exists($envFile)) { 49 | $this->getIo()->warning('File '. $envFile . ' not found.'); 50 | 51 | return 1; 52 | } 53 | 54 | $fileContent = file_get_contents($envFile); 55 | $this->getIo()->writeln($fileContent); 56 | 57 | $this->getIo()->warning('This command is deprecated use instead: `cat .env`'); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Command/Generate/FormBaseCommand.php: -------------------------------------------------------------------------------- 1 | setFormType('FormBase'); 15 | $this->setCommandName('generate:form'); 16 | $this->setAliases(['gf']); 17 | parent::configure(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Command/Router/RebuildCommand.php: -------------------------------------------------------------------------------- 1 | routerBuilder = $routerBuilder; 30 | parent::__construct(); 31 | } 32 | 33 | protected function configure() 34 | { 35 | $this 36 | ->setName('router:rebuild') 37 | ->setDescription($this->trans('commands.router.rebuild.description')) 38 | ->setAliases(['rr']); 39 | } 40 | 41 | protected function execute(InputInterface $input, OutputInterface $output) 42 | { 43 | $this->getIo()->newLine(); 44 | $this->getIo()->comment( 45 | $this->trans('commands.router.rebuild.messages.rebuilding') 46 | ); 47 | 48 | if(!$this->routerBuilder->rebuild()) { 49 | $this->getIo()->error( 50 | $this->trans('commands.router.rebuild.messages.error-rebuild') 51 | ); 52 | return 1; 53 | } 54 | 55 | $this->getIo()->success( 56 | $this->trans('commands.router.rebuild.messages.completed') 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Command/Shared/ArrayInputTrait.php: -------------------------------------------------------------------------------- 1 | getIo()->getInput(); 24 | $yes = $input->hasOption('yes') ? $input->getOption('yes') : false; 25 | if ($yes) { 26 | return $yes; 27 | } 28 | 29 | $confirmation = $this->getIo()->confirm( 30 | $this->trans('commands.common.questions.confirm'), 31 | true 32 | ); 33 | 34 | if (!$confirmation) { 35 | $this->getIo()->warning($this->trans('commands.common.messages.canceled')); 36 | } 37 | 38 | return $confirmation; 39 | } 40 | 41 | /** 42 | * @deprecated 43 | */ 44 | public function confirmGeneration() 45 | { 46 | return $this->confirmOperation(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Command/Shared/CreateTrait.php: -------------------------------------------------------------------------------- 1 | sprintf('N | %s', $this->trans('commands.create.nodes.questions.time-ranges.0')), 24 | 3600 => sprintf('H | %s', $this->trans('commands.create.nodes.questions.time-ranges.1')), 25 | 86400 => sprintf('D | %s', $this->trans('commands.create.nodes.questions.time-ranges.2')), 26 | 604800 => sprintf('W | %s', $this->trans('commands.create.nodes.questions.time-ranges.3')), 27 | 2592000 => sprintf('M | %s', $this->trans('commands.create.nodes.questions.time-ranges.4')), 28 | 31536000 => sprintf('Y | %s', $this->trans('commands.create.nodes.questions.time-ranges.5')) 29 | ]; 30 | 31 | return $timeRanges; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Command/Shared/TranslationTrait.php: -------------------------------------------------------------------------------- 1 | setName('shell') 25 | ->setDescription($this->trans('commands.shell.description')) 26 | ->setHelp($this->trans('commands.shell.help')); 27 | } 28 | 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | protected function execute(InputInterface $input, OutputInterface $output) 33 | { 34 | $config = new Configuration; 35 | $shell = new Shell($config); 36 | $shell->run(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Extension/Discovery.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | $blockId = $parameters['block_id']; 40 | $description = $parameters['description']; 41 | $parameters['machine_name'] = $blockId; 42 | 43 | $this->renderFile( 44 | 'module/src/Plugin/Block/blocktype.php.twig', 45 | $this->extensionManager->getPluginPath($module, 'Block') . '/' . $class_name . '.php', 46 | $parameters 47 | ); 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Generator/BreakPointGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function generate(array $parameters) 38 | { 39 | $theme_path = $this->extensionManager->getTheme($parameters['theme'])->getPath(); 40 | 41 | $this->renderFile( 42 | 'theme/breakpoints.yml.twig', 43 | $theme_path . '/' . $parameters['machine_name'] . '.breakpoints.yml', 44 | $parameters, 45 | FILE_APPEND 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Generator/DatabaseSettingsGenerator.php: -------------------------------------------------------------------------------- 1 | renderFile( 34 | $template, 35 | $settingsFile, 36 | $parameters, 37 | FILE_APPEND 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Generator/DockerInitGenerator.php: -------------------------------------------------------------------------------- 1 | getVolumeConfiguration(); 21 | 22 | $dockerComposeFile = $parameters['docker_compose_file']; 23 | unset($parameters['docker_compose_file']); 24 | 25 | $this->renderFile( 26 | 'files/docker-compose.yml.twig', 27 | $dockerComposeFile, 28 | $parameters 29 | ); 30 | } 31 | 32 | protected function getVolumeConfiguration() { 33 | $volumeConfiguration = [ 34 | 'darwin' => ':cached' 35 | ]; 36 | 37 | $osType = strtolower(PHP_OS); 38 | 39 | return array_key_exists($osType, $volumeConfiguration)?$volumeConfiguration[$osType]:''; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Generator/DotenvInitGenerator.php: -------------------------------------------------------------------------------- 1 | drupalFinder 24 | ->getDrupalRoot() . '/sites/default/settings.php'; 25 | $settingsFileContent = file_get_contents($settingsFile); 26 | 27 | $settingsTwigContent = $this->renderer->render( 28 | 'files/settings.php.twig', 29 | $parameters 30 | ); 31 | 32 | file_put_contents( 33 | $settingsFile, 34 | $settingsFileContent . 35 | $settingsTwigContent 36 | ); 37 | 38 | $fs->chmod($settingsFile, 0666); 39 | 40 | // Create .env File 41 | $envFile = $this->drupalFinder->getComposerRoot() . '/.env'; 42 | $this->renderFile( 43 | 'files/.env.dist.twig', 44 | $envFile, 45 | $parameters 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Generator/FormAlterGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $module_path = $this->extensionManager->getModule($module)->getPath(); 38 | $moduleFilePath = $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.module'; 39 | 40 | $parameters = array_merge($parameters, [ 41 | 'file_exists' => file_exists($moduleFilePath), 42 | ]); 43 | 44 | $this->renderFile( 45 | 'module/src/Form/form-alter.php.twig', 46 | $module_path . '/' . $module . '.module', 47 | $parameters, 48 | FILE_APPEND 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Generator/HelpGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['machine_name']; 37 | $moduleFilePath = $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.module'; 38 | 39 | $parameters = array_merge($parameters, [ 40 | 'file_exists' => file_exists($moduleFilePath), 41 | ]); 42 | 43 | $this->renderFile( 44 | 'module/help.php.twig', 45 | $moduleFilePath, 46 | $parameters, 47 | FILE_APPEND 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Generator/JsTestGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | public function generate(array $parameters) 39 | { 40 | $class = $parameters['class']; 41 | $module = $parameters['module']; 42 | 43 | $this->renderFile( 44 | 'module/src/Tests/js-test.php.twig', 45 | $this->extensionManager->getModule($module)->getJsTestsPath() . "/$class.php", 46 | $parameters 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Generator/ModuleFileGenerator.php: -------------------------------------------------------------------------------- 1 | renderFile( 43 | 'module/module-file.twig', 44 | $moduleFilePath, 45 | $parameters 46 | ); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Generator/PermissionGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module_name']; 37 | $learning = $parameters['learning']; 38 | 39 | $this->renderFile( 40 | 'module/permission.yml.twig', 41 | $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.permissions.yml', 42 | $parameters, 43 | FILE_APPEND 44 | ); 45 | 46 | $content = $this->renderer->render( 47 | 'module/permission-routing.yml.twig', 48 | $parameters 49 | ); 50 | 51 | if ($learning) { 52 | echo 'You can use this permission in the routing file like this:' . PHP_EOL; 53 | echo $content; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Generator/PluginCKEditorButtonGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $class_name = $parameters['class_name']; 37 | $module = $parameters['module']; 38 | $plugin_id = $parameters['plugin_id']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/CKEditorPlugin/ckeditorbutton.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'CKEditorPlugin') . '/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | $this->renderFile( 46 | 'module/src/Plugin/CKEditorPlugin/plugin.php.twig', 47 | drupal_get_path('module', $module) . '/js/Plugin/'. $plugin_id .'/plugin.js', 48 | $parameters 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Generator/PluginConditionGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function generate(array $parameters) 40 | { 41 | $module = $parameters['module']; 42 | $class_name = $parameters['class_name']; 43 | $context_definition_id = $parameters['context_definition_id']; 44 | $parameters['context_id'] = str_replace('entity:', '', $context_definition_id); 45 | 46 | $this->renderFile( 47 | 'module/src/Plugin/Condition/condition.php.twig', 48 | $this->extensionManager->getPluginPath($module, 'Condition') . '/' . $class_name . '.php', 49 | $parameters 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Generator/PluginDerivativeGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class']; 38 | $blockLabel = $parameters['block_label']; 39 | $blockDescription = $parameters['block_description']; 40 | $blockId = $parameters['block_id']; 41 | 42 | //block_derivative.php.twig 43 | $this->renderFile( 44 | 'module/src/Plugin/Block/block_derivative.php.twig', 45 | $this->extensionManager->getPluginPath($module, 'Block') . '/' . $class_name . '.php', 46 | $parameters 47 | ); 48 | 49 | //derivative_block_derivative.php.twig 50 | $this->renderFile( 51 | 'module/src/Plugin/Derivative/derivative_block_derivative.php.twig', 52 | $this->extensionManager->getPluginPath($module, 'Derivative') . '/' . $class_name . '.php', 53 | $parameters 54 | ); 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Generator/PluginFieldFormatterGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function generate(array $parameters) 30 | { 31 | $module = $parameters['module']; 32 | $class_name = $parameters['class_name']; 33 | 34 | $this->renderFile( 35 | 'module/src/Plugin/Field/FieldFormatter/fieldformatter.php.twig', 36 | $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', 37 | $parameters 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Generator/PluginFieldTypeGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/Field/FieldType/fieldtype.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'Field/FieldType') . '/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Generator/PluginFieldWidgetGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $moduleInstance = $this->extensionManager->getModule($module); 41 | 42 | $this->renderFile( 43 | 'module/src/Plugin/Field/FieldWidget/fieldwidget.php.twig', 44 | $this->extensionManager->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php', 45 | $parameters 46 | ); 47 | 48 | $this->renderFile( 49 | 'module/schema.yml.twig', 50 | $moduleInstance->getPath() . '/' . $module . '.schema.yml', 51 | $parameters, 52 | FILE_APPEND 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Generator/PluginImageEffectGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/ImageEffect/imageeffect.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'ImageEffect') . '/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Generator/PluginImageFormatterGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Generator/PluginMailGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/Mail/mail.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'Mail') . '/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Generator/PluginMigrateDataParserGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/migrate_plus/data_parser/data_parser.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'migrate_plus') . '/data_parser/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginMigrateProcessGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/migrate/process/process.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'migrate') . '/process/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginMigrateSourceGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/migrate/source/source.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'migrate') . '/source/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginQueueWorkerGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | public function generate(array $parameters) { 39 | $module = $parameters['module']; 40 | $queue_class = $parameters['class_name']; 41 | 42 | $this->renderer->addSkeletonDir(__DIR__ . '/../../console/templates'); 43 | $this->renderFile( 44 | 'module/src/Plugin/QueueWorker/queue_worker.php.twig', 45 | $this->extensionManager->getPluginPath($module, 'QueueWorker') . '/' . $queue_class . '.php', 46 | $parameters 47 | ); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/Generator/PluginRestResourceGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function generate(array $parameters) 36 | { 37 | $module = $parameters['module_name']; 38 | $class_name = $parameters['class_name']; 39 | 40 | $this->renderFile( 41 | 'module/src/Plugin/Rest/Resource/rest.php.twig', 42 | $this->extensionManager->getPluginPath($module, 'rest') . '/resource/' . $class_name . '.php', 43 | $parameters 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Generator/PluginRulesActionGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/RulesAction/rulesaction.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'RulesAction') . '/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginRulesConditionGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/Condition/rulescondition.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'Condition') . '/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginRulesDataprocessorGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class_name = $parameters['class_name']; 38 | 39 | $this->renderFile( 40 | 'module/src/Plugin/RulesDataProcessor/rulesdataprocessor.php.twig', 41 | $this->extensionManager->getPluginPath($module, 'RulesDataProcessor') . '/' . $class_name . '.php', 42 | $parameters 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Generator/PluginSkeletonGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $className = $parameters['class_name']; 37 | $module = $parameters['module']; 38 | $pluginMetaData = $parameters['plugin_metadata']; 39 | 40 | $parameters['plugin_annotation'] = current(explode('\\', $pluginMetaData['pluginAnnotation'])); 41 | $parameters['plugin_interface'] = current(explode('\\', $pluginMetaData['pluginInterface'])); 42 | $parameters['namespace'] = str_replace('/', '\\', $pluginMetaData['subdir']); 43 | 44 | $this->renderFile( 45 | 'module/src/Plugin/skeleton.php.twig', 46 | $this->extensionManager->getModule($module)->getPath() . '/src/' . $pluginMetaData['subdir'] . '/' . $className . '.php', 47 | array_merge($parameters, $pluginMetaData) 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Generator/PluginViewsFieldGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $fields = $parameters['fields']; 38 | 39 | $this->renderFile( 40 | 'module/module.views.inc.twig', 41 | $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.views.inc', 42 | $parameters, 43 | FILE_APPEND 44 | ); 45 | 46 | foreach ($fields as $field) { 47 | $field['module'] = $module; 48 | $this->renderFile( 49 | 'module/src/Plugin/Views/field/field.php.twig', 50 | $this->extensionManager->getPluginPath($module, 'views/field') . '/' . $field['class_name'] . '.php', 51 | $field 52 | ); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Generator/PostUpdateGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $postUpdateFile = $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.post_update.php'; 38 | 39 | $parameters['file_exists'] = file_exists($postUpdateFile); 40 | 41 | $this->renderFile( 42 | 'module/post-update.php.twig', 43 | $postUpdateFile, 44 | $parameters, 45 | FILE_APPEND 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Generator/RouteSubscriberGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $class = $parameters['class']; 38 | $moduleInstance = $this->extensionManager->getModule($module); 39 | $moduleServiceYaml = $moduleInstance->getPath() . '/' . $module . '.services.yml'; 40 | $parameters['class_path'] = sprintf('Drupal\%s\Routing\%s', $module, $class); 41 | $parameters['tags'] = ['name' => 'event_subscriber']; 42 | $parameters['file_exists'] = file_exists($moduleServiceYaml); 43 | 44 | $this->renderFile( 45 | 'module/src/Routing/route-subscriber.php.twig', 46 | $moduleInstance->getRoutingPath() . '/' . $class . '.php', 47 | $parameters 48 | ); 49 | 50 | $this->renderFile( 51 | 'module/services.yml.twig', 52 | $moduleServiceYaml, 53 | $parameters, 54 | FILE_APPEND 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Generator/UpdateGenerator.php: -------------------------------------------------------------------------------- 1 | extensionManager = $extensionManager; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function generate(array $parameters) 35 | { 36 | $module = $parameters['module']; 37 | $update_number = $parameters['update_number']; 38 | $updateFile = $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.install'; 39 | 40 | $parameters = [ 41 | 'module' => $module, 42 | 'update_number' => $update_number, 43 | 'file_exists' => file_exists($updateFile) 44 | ]; 45 | 46 | $this->renderFile( 47 | 'module/update.php.twig', 48 | $updateFile, 49 | $parameters, 50 | FILE_APPEND 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Override/ConfigSubscriber.php: -------------------------------------------------------------------------------- 1 | stopPropagation(); 24 | return true; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Plugin/ScriptHandler.php: -------------------------------------------------------------------------------- 1 | getComposer()->getPackage()->getRequires()); 24 | if (!$packages) { 25 | return; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Utils/Create/RoleData.php: -------------------------------------------------------------------------------- 1 | getRandom()->word(mt_rand(6, 12)); 35 | 36 | $role = $this->entityTypeManager->getStorage('user_role')->create( 37 | [ 38 | 'id' => $rolename, 39 | 'label' => $rolename, 40 | 'originalId' => $rolename 41 | ] 42 | ); 43 | 44 | $role->save(); 45 | 46 | $roles['success'][] = [ 47 | 'role-id' => $role->id(), 48 | 'role-name' => $role->get('label') 49 | ]; 50 | } catch (\Exception $error) { 51 | $roles['error'][] = $error->getMessage(); 52 | } 53 | } 54 | 55 | return $roles; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Utils/MigrateExecuteMessageCapture.php: -------------------------------------------------------------------------------- 1 | messages[] = $message; 30 | } 31 | 32 | /** 33 | * Clear out any captured messages. 34 | */ 35 | public function clear() 36 | { 37 | $this->messages = []; 38 | } 39 | 40 | /** 41 | * Return any captured messages. 42 | * 43 | * @return array 44 | */ 45 | public function getMessages() 46 | { 47 | return $this->messages; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Zippy/Adapter/TarGzGNUTarForWindowsAdapter.php: -------------------------------------------------------------------------------- 1 | '{{ database }}', 4 | 'username' => '{{ username }}', 5 | 'password' => '{{ password }}', 6 | 'host' => '{{ host }}', 7 | 'port' => '{{ port }}', 8 | 'driver' => '{{ driver }}', 9 | 'prefix' => '{{ prefix }}', 10 | ]; 11 | -------------------------------------------------------------------------------- /templates/database/add.php.twig: -------------------------------------------------------------------------------- 1 | 2 | $databases['{{ database }}']['default'] = [ 3 | 'database' => '{{ database }}', 4 | 'username' => '{{ username }}', 5 | 'password' => '{{ password }}', 6 | 'host' => '{{ host }}', 7 | 'port' => '{{ port }}', 8 | 'driver' => '{{ driver }}', 9 | 'prefix' => '{{ prefix }}', 10 | ]; 11 | -------------------------------------------------------------------------------- /templates/files/.env.dist.twig: -------------------------------------------------------------------------------- 1 | {{ yaml_comment('commands.dotenv.init.messages.template-env') }} 2 | 3 | # ENV 4 | ENVIRONMENT={{ environment }} 5 | 6 | # Database 7 | DATABASE_NAME={{ database_name }} 8 | DATABASE_USER={{ database_user }} 9 | DATABASE_PASSWORD={{ database_password }} 10 | DATABASE_HOST={{ database_host }} 11 | DATABASE_PORT={{ database_port }} 12 | 13 | # HOST 14 | HOST_NAME={{ host_name }} 15 | HOST_PORT={{ host_port }} 16 | 17 | # Default values for drupal-composer 18 | DRUPAL_ROOT={{ drupal_root }} 19 | SERVER_ROOT={{ server_root }} 20 | 21 | {% if load_settings is defined %} 22 | # SETTINGS 23 | SETTINGS_BAR=baz 24 | SETTINGS_LOREM=ipsum 25 | {% endif %} 26 | -------------------------------------------------------------------------------- /templates/files/.gitignore.dist: -------------------------------------------------------------------------------- 1 | 2 | # dotenv file 3 | .env 4 | 5 | # backup files 6 | *.original 7 | *.backup -------------------------------------------------------------------------------- /templates/files/settings.php.twig: -------------------------------------------------------------------------------- 1 | {% if load_from_env is defined %} 2 | {{ yaml_comment('commands.dotenv.init.messages.load-from-env') }} 3 | {% endif %} 4 | 5 | # Load environment 6 | $env = getenv('ENVIRONMENT'); 7 | 8 | {% if load_settings is defined %} 9 | {{ yaml_comment('commands.dotenv.init.messages.load-settings') }} 10 | {% endif %} 11 | $base_path = $app_root . '/' . $site_path; 12 | $servicesFile = $base_path . '/services.'.$env.'.yml'; 13 | $settingsFile = $base_path . '/settings.'.$env.'.php'; 14 | 15 | // Load services definition file. 16 | if (file_exists($servicesFile)) { 17 | $settings['container_yamls'][] = $servicesFile; 18 | } 19 | 20 | // Load settings file. 21 | if (file_exists($settingsFile)) { 22 | include $settingsFile; 23 | } 24 | 25 | $databases['default']['default'] = array ( 26 | 'database' => getenv('DATABASE_NAME'), 27 | 'username' => getenv('DATABASE_USER'), 28 | 'password' => getenv('DATABASE_PASSWORD'), 29 | 'prefix' => '', 30 | 'host' => getenv('DATABASE_HOST'), 31 | 'port' => getenv('DATABASE_PORT'), 32 | 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', 33 | 'driver' => 'mysql', 34 | ); 35 | -------------------------------------------------------------------------------- /templates/module/Tests/Controller/controller.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Tests\{{ class_name }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Tests; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\simpletest\WebTestBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides automated tests for the {{module}} module. 18 | */ 19 | class {{class_name}}Test extends WebTestBase {% endblock %} 20 | {% block class_methods %} 21 | 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public static function getInfo() { 26 | return [ 27 | 'name' => "{{module}} {{class_name}}'s controller functionality", 28 | 'description' => 'Test Unit for module {{module}} and controller {{class_name}}.', 29 | 'group' => 'Other', 30 | ]; 31 | } 32 | 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | public function setUp() { 37 | parent::setUp(); 38 | } 39 | 40 | /** 41 | * Tests {{module}} functionality. 42 | */ 43 | public function test{{class_name}}() { 44 | // Check that the basic functions of module {{module}}. 45 | $this->assertEquals(TRUE, TRUE, 'Test Unit Generated via Drupal Console.'); 46 | } 47 | {% endblock %} 48 | -------------------------------------------------------------------------------- /templates/module/config/install/field.default.yml.twig: -------------------------------------------------------------------------------- 1 | {{ module_name }}: 2 | {% for input in inputs %} 3 | {% if input.default_value is defined and input.default_value|length %} 4 | {% if input.default_value is iterable %} 5 | {{ input.name }}: 6 | {% for value in input.default_value %} 7 | - {{ value }} 8 | {% endfor %} 9 | {% else %} 10 | {% if input.type in ['checkbox','number','radio'] %} 11 | {{ input.name }}: {{ input.default_value }} 12 | {% else %} 13 | {{ input.name }}: "{{ input.default_value }}" 14 | {% endif %} 15 | {% endif %} 16 | {% endif %} 17 | {% endfor %} 18 | -------------------------------------------------------------------------------- /templates/module/config/schema/entity.schema.yml.twig: -------------------------------------------------------------------------------- 1 | {{ module }}.{{ entity_name }}.*: 2 | type: config_entity 3 | label: '{{ label }} config' 4 | mapping: 5 | id: 6 | type: string 7 | label: 'ID' 8 | label: 9 | type: label 10 | label: 'Label' 11 | uuid: 12 | type: string 13 | -------------------------------------------------------------------------------- /templates/module/entity-content-page.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | 3 | {% block file_path %} 4 | {{ entity_name }}.page.inc{% endblock %} 5 | {% block extra_info %} 6 | * 7 | * Page callback for {{ label }} entities. 8 | {% endblock %} 9 | 10 | {% block use_class %} 11 | use Drupal\Core\Render\Element; 12 | {% endblock %} 13 | 14 | {% block file_methods %} 15 | /** 16 | * Prepares variables for {{ label }} templates. 17 | * 18 | * Default template: {{ entity_name }}.html.twig. 19 | * 20 | * @param array $variables 21 | * An associative array containing: 22 | * - elements: An associative array containing the user information and any 23 | * - attributes: HTML attributes for the containing element. 24 | */ 25 | function template_preprocess_{{ entity_name | machine_name }}(array &$variables) { 26 | // Fetch {{ entity_class }} Entity Object. 27 | ${{ entity_name | machine_name }} = $variables['elements']['#{{ entity_name }}']; 28 | 29 | // Helpful $content variable for templates. 30 | foreach (Element::children($variables['elements']) as $key) { 31 | $variables['content'][$key] = $variables['elements'][$key]; 32 | } 33 | } 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /templates/module/features.yml.twig: -------------------------------------------------------------------------------- 1 | bundle: {{ bundle }} 2 | -------------------------------------------------------------------------------- /templates/module/help.php.twig: -------------------------------------------------------------------------------- 1 | {% block file_methods %} 2 | {% if not file_exists %} 3 | {% include 'module/php_tag.php.twig' %} 4 | 5 | /** 6 | * @file 7 | * Main module help for the {{ machine_name }} module. 8 | */ 9 | 10 | {% endif %} 11 | use Drupal\Core\Routing\RouteMatchInterface; 12 | 13 | /** 14 | * Implements hook_help(). 15 | */ 16 | function {{machine_name}}_help($route_name, RouteMatchInterface $route_match) { 17 | switch ($route_name) { 18 | // Main module help for the {{ machine_name }} module. 19 | case 'help.page.{{ machine_name }}': 20 | $output = ''; 21 | $output .= '

' . t('About') . '

'; 22 | $output .= '

' . t('{{ description|escape }}') . '

'; 23 | return $output; 24 | 25 | default: 26 | } 27 | } 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /templates/module/info.yml.twig: -------------------------------------------------------------------------------- 1 | name: '{{ module }}' 2 | type: {{ type }} 3 | description: '{{ description }}' 4 | core: {{ core }} 5 | package: '{{ package }}' 6 | {% if dependencies %} 7 | dependencies: 8 | {% for dependency in dependencies %} 9 | - {{ dependency }} 10 | {% endfor %} 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /templates/module/js/commands.php.twig: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | */ 4 | 5 | (function ($, Drupal) { 6 | Drupal.AjaxCommands.prototype.{{ method }} = function (ajax, response, status) { 7 | console.log(response.message); 8 | } 9 | 10 | })(jQuery, Drupal); 11 | -------------------------------------------------------------------------------- /templates/module/links.action-entity-content.yml.twig: -------------------------------------------------------------------------------- 1 | entity.{{ entity_name }}.add_form: 2 | {# Note: a content entity with bundles will add via a dedicated controller. #} 3 | {% if not bundle_entity_type %} 4 | route_name: entity.{{ entity_name }}.add_form 5 | {% else %} 6 | route_name: entity.{{ entity_name }}.add_page 7 | {% endif %} 8 | title: 'Add {{ label }}' 9 | appears_on: 10 | - entity.{{ entity_name }}.collection 11 | -------------------------------------------------------------------------------- /templates/module/links.action-entity.yml.twig: -------------------------------------------------------------------------------- 1 | entity.{{ entity_name }}.add_form: 2 | route_name: entity.{{ entity_name }}.add_form 3 | title: 'Add {{ label }}' 4 | appears_on: 5 | - entity.{{ entity_name }}.collection 6 | -------------------------------------------------------------------------------- /templates/module/links.menu-entity-config.yml.twig: -------------------------------------------------------------------------------- 1 | {# Initial new line ensures that the new definitions starts on a new line #} 2 | 3 | # {{ label }} menu items definition 4 | entity.{{ entity_name }}.collection: 5 | title: '{{ label }}' 6 | route_name: entity.{{ entity_name }}.collection 7 | description: 'List {{ label }} (bundles)' 8 | parent: system.admin_structure 9 | weight: 99 10 | -------------------------------------------------------------------------------- /templates/module/links.menu-entity-content.yml.twig: -------------------------------------------------------------------------------- 1 | {# Initial new line ensures that the new definitions starts on a new line #} 2 | 3 | # {{ label }} menu items definition 4 | entity.{{ entity_name }}.collection: 5 | title: '{{ label }} list' 6 | route_name: entity.{{ entity_name }}.collection 7 | description: 'List {{ label }} entities' 8 | parent: system.admin_structure 9 | weight: 100 10 | 11 | {# Note: a content entity with bundles will have the settings configured on the bundle (config) entity. #} 12 | {% if not bundle_entity_type %} 13 | {{ entity_name }}.admin.structure.settings: 14 | title: '{{ label }} settings' 15 | description: 'Configure {{ label }} entities' 16 | route_name: {{ entity_name }}.settings 17 | parent: system.admin_structure 18 | {% endif %} 19 | -------------------------------------------------------------------------------- /templates/module/links.menu.yml.twig: -------------------------------------------------------------------------------- 1 | {{ module_name }}.{{form_id}}: 2 | title: '{{ menu_link_title }}' 3 | route_name: {{ module_name }}.{{form_id}} 4 | description: '{{ menu_link_desc }}' 5 | parent: {{ menu_parent }} 6 | weight: 99 7 | -------------------------------------------------------------------------------- /templates/module/links.task-entity-content.yml.twig: -------------------------------------------------------------------------------- 1 | # {{ label }} routing definition 2 | {# Note: a content entity with bundles will have the settings configured on the bundle (config) entity. #} 3 | {% if not bundle_entity_type %} 4 | {{ entity_name }}.settings_tab: 5 | route_name: {{ entity_name }}.settings 6 | title: 'Settings' 7 | base_route: {{ entity_name }}.settings 8 | {% else %} 9 | entity.{{ entity_name }}_type.edit_form: 10 | route_name: entity.{{ entity_name }}_type.edit_form 11 | base_route: entity.{{ entity_name }}_type.edit_form 12 | title: 'Edit' 13 | weight: 0 14 | {% endif %} 15 | 16 | entity.{{ entity_name }}.canonical: 17 | route_name: entity.{{ entity_name }}.canonical 18 | base_route: entity.{{ entity_name }}.canonical 19 | title: 'View' 20 | 21 | entity.{{ entity_name }}.edit_form: 22 | route_name: entity.{{ entity_name }}.edit_form 23 | base_route: entity.{{ entity_name }}.canonical 24 | title: 'Edit' 25 | {% if revisionable %} 26 | 27 | entity.{{ entity_name }}.version_history: 28 | route_name: entity.{{ entity_name }}.version_history 29 | base_route: entity.{{ entity_name }}.canonical 30 | title: 'Revisions' 31 | {% endif %} 32 | 33 | entity.{{ entity_name }}.delete_form: 34 | route_name: entity.{{ entity_name }}.delete_form 35 | base_route: entity.{{ entity_name }}.canonical 36 | title: Delete 37 | weight: 10 38 | -------------------------------------------------------------------------------- /templates/module/module-block-twig-template-append.twig: -------------------------------------------------------------------------------- 1 | {% if file_exist == false %} 2 | [ 16 | 'variables' => [ 17 | 'content' => NULL 18 | ], 19 | 'render element' => 'children', 20 | ], 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /templates/module/module-file.twig: -------------------------------------------------------------------------------- 1 | {% include 'module/php_tag.php.twig' %} 2 | 3 | /** 4 | * @file 5 | * Contains {{machine_name}}.module. 6 | */ 7 | -------------------------------------------------------------------------------- /templates/module/module-libraries.yml.twig: -------------------------------------------------------------------------------- 1 | {{ module }}-library: 2 | js: 3 | js/{{ js_name }}.js: {} 4 | dependencies: 5 | - core/drupal.ajax 6 | -------------------------------------------------------------------------------- /templates/module/module-twig-template-append.twig: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Implements hook_theme(). 4 | */ 5 | function {{machine_name}}_theme() { 6 | return [ 7 | '{{machine_name}}' => [ 8 | 'render element' => 'children', 9 | ], 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /templates/module/module.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | 3 | {% block file_path %}{{machine_name}}.module{% endblock %} 4 | 5 | {% block use_class %} 6 | use Drupal\Core\Routing\RouteMatchInterface; 7 | {% endblock %} 8 | 9 | {% block file_methods %} 10 | /** 11 | * Implements hook_help(). 12 | */ 13 | function {{machine_name}}_help($route_name, RouteMatchInterface $route_match) { 14 | switch ($route_name) { 15 | // Main module help for the {{ machine_name }} module. 16 | case 'help.page.{{ machine_name }}': 17 | $output = ''; 18 | $output .= '

' . t('About') . '

'; 19 | {% if description %} 20 | $output .= '

' . t('{{ description|escape }}') . '

'; 21 | {% endif %} 22 | return $output; 23 | 24 | default: 25 | } 26 | } 27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /templates/module/module.views.inc.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/file.php.twig" %} 2 | 3 | {% block file_path %}{{ module }}\{{ module }}.views.inc.{% endblock %} 4 | 5 | {% block extra_info %} * Provide a custom views field data that isn't tied to any other module.{% endblock %} 6 | 7 | {% block file_methods %} 8 | /** 9 | * Implements hook_views_data(). 10 | */ 11 | function {{module}}_views_data() { 12 | 13 | $data['views']['table']['group'] = t('Custom Global'); 14 | $data['views']['table']['join'] = [ 15 | // #global is a special flag which allows a table to appear all the time. 16 | '#global' => [], 17 | ]; 18 | 19 | {% for field in fields %} 20 | $data['views']['{{ field.class_machine_name }}'] = [ 21 | 'title' => t('{{ field.title }}'), 22 | 'help' => t('{{ field.description }}'), 23 | 'field' => [ 24 | 'id' => '{{ field.class_machine_name }}', 25 | ], 26 | ]; 27 | {% endfor %} 28 | return $data; 29 | } 30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /templates/module/permission-routing.yml.twig: -------------------------------------------------------------------------------- 1 | {% block routing_file %} 2 | {% endblock %} 3 | {% if permissions|length %} 4 | {% for permission in permissions %} 5 | {{ module_name }}.route: 6 | requirements: 7 | _permission: {{ permission.permission }}: 8 | {% endfor %} 9 | {% endif %} 10 | 11 | -------------------------------------------------------------------------------- /templates/module/permission.yml.twig: -------------------------------------------------------------------------------- 1 | {% if permissions|length %} 2 | {% for permission in permissions %} 3 | {{ permission.permission }}: 4 | title: '{{ permission.title }}' 5 | description: '{{ permission.description }}' 6 | {% if permission.restrict_access != 'none' %} 7 | restrict access: {{ permission.restrict_access }} 8 | {% endif %} 9 | {% endfor %} 10 | {% endif %} 11 | -------------------------------------------------------------------------------- /templates/module/permissions-entity-content.yml.twig: -------------------------------------------------------------------------------- 1 | add {{ label|lower }} entities: 2 | title: 'Create new {{ label }} entities' 3 | 4 | administer {{ label|lower }} entities: 5 | title: 'Administer {{ label }} entities' 6 | description: 'Allow to access the administration form to configure {{ label }} entities.' 7 | restrict access: true 8 | 9 | delete {{ label|lower }} entities: 10 | title: 'Delete {{ label }} entities' 11 | 12 | edit {{ label|lower }} entities: 13 | title: 'Edit {{ label }} entities' 14 | 15 | view published {{ label|lower }} entities: 16 | title: 'View published {{ label }} entities' 17 | 18 | view unpublished {{ label|lower }} entities: 19 | title: 'View unpublished {{ label }} entities' 20 | {% if revisionable %} 21 | 22 | view all {{ label|lower }} revisions: 23 | title: 'View all {{ label }} revisions' 24 | 25 | revert all {{ label|lower }} revisions: 26 | title: 'Revert all {{ label }} revisions' 27 | description: 'Role requires permission view {{ label }} revisions and edit rights for {{ label|lower }} entities in question or administer {{ label|lower }} entities.' 28 | 29 | delete all {{ label|lower }} revisions: 30 | title: 'Delete all revisions' 31 | description: 'Role requires permission to view {{ label }} revisions and delete rights for {{ label|lower }} entities in question or administer {{ label|lower }} entities.' 32 | {% endif %} 33 | 34 | {% if has_bundle_permissions %} 35 | permission_callbacks: 36 | - \Drupal\{{ module }}\{{ entity_class}}Permissions::generatePermissions 37 | {% endif %} 38 | -------------------------------------------------------------------------------- /templates/module/php_tag.php.twig: -------------------------------------------------------------------------------- 1 | addMessage('Module {{ module }} Post Update # {{ post_update_name }} () was executed successfully.'); 10 | } 11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /templates/module/routing-controller.yml.twig: -------------------------------------------------------------------------------- 1 | {% if class_name is defined %} 2 | 3 | {% for route in routes %} 4 | {% if learning is defined and learning %} 5 | {{ yaml_comment('application.messages.learning.route') }} 6 | {% endif %} 7 | {{ route.name }}: 8 | path: '{{ route.path }}' 9 | defaults: 10 | _controller: '\Drupal\{{ module }}\Controller\{{ class_name }}::{{ route.method }}' 11 | _title: '{{route.title}}' 12 | requirements: 13 | _permission: 'access content' 14 | {% endfor %} 15 | {% endif %} 16 | -------------------------------------------------------------------------------- /templates/module/routing-form.yml.twig: -------------------------------------------------------------------------------- 1 | {% if class_name is defined %} 2 | {{ module_name }}.{{form_id}}: 3 | path: '{{ path }}' 4 | defaults: 5 | _form: '\Drupal\{{ module_name }}\Form\{{ class_name }}' 6 | _title: '{{ class_name }}' 7 | {% if config_form %} 8 | requirements: 9 | _permission: 'access administration pages' 10 | options: 11 | _admin_route: TRUE 12 | {% else %} 13 | requirements: 14 | _access: 'TRUE' 15 | {% endif %} 16 | {% endif %} 17 | -------------------------------------------------------------------------------- /templates/module/schema.yml.twig: -------------------------------------------------------------------------------- 1 | field.widget.settings.{{ plugin_id }}: 2 | type: mapping 3 | label: '{{ label }} widget settings' 4 | mapping: 5 | size: 6 | type: integer 7 | label: 'Size' 8 | placeholder: 9 | type: textfield 10 | label: 'Placeholder' 11 | -------------------------------------------------------------------------------- /templates/module/services.yml.twig: -------------------------------------------------------------------------------- 1 | {% if not file_exists %} 2 | services: 3 | {% endif %} 4 | {% if logger_channel is defined %} 5 | logger.channel.{{ module }}: 6 | parent: logger.channel_base 7 | arguments: ['{{ module }}'] 8 | {% endif %} 9 | {% if name is defined %} 10 | {{ name | lower }}: 11 | class: {{ class_path }} 12 | {% if services is defined %} 13 | arguments: [{{ servicesAsParametersKeys(services)|join(', ') }}] 14 | {% endif %} 15 | {% if tags is defined %} 16 | tags: 17 | - { {{ tagsAsArray(tags)|join(', ') }} } 18 | {% endif %} 19 | {% endif %} 20 | -------------------------------------------------------------------------------- /templates/module/src/Ajax/ajax-command.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Ajax\{{ class_name }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Ajax; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Ajax\CommandInterface; 13 | {% endblock %} 14 | {% block class_declaration %} 15 | /** 16 | * Class {{ class_name }}. 17 | */ 18 | class {{ class_name }} implements CommandInterface {% endblock %} 19 | 20 | {% block class_methods %} 21 | /** 22 | * Render custom ajax command. 23 | * 24 | * @return ajax 25 | * Command function. 26 | */ 27 | public function render() { 28 | return [ 29 | 'command' => '{{ method }}', 30 | 'message' => 'My Awesome Message', 31 | ]; 32 | } 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /templates/module/src/Annotation/plugin-type.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Annotation\{{ class_name }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Annotation; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Component\Annotation\Plugin; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Defines a {{ label }} item annotation object. 18 | * 19 | * @see \Drupal\{{ module }}\Plugin\{{ class_name }}Manager 20 | * @see plugin_api 21 | * 22 | * @Annotation 23 | */ 24 | class {{ class_name }} extends Plugin {% endblock %} 25 | {% block class_methods %} 26 | 27 | /** 28 | * The plugin ID. 29 | * 30 | * @var string 31 | */ 32 | public $id; 33 | 34 | /** 35 | * The label of the plugin. 36 | * 37 | * @var \Drupal\Core\Annotation\Translation 38 | * 39 | * @ingroup plugin_translatable 40 | */ 41 | public $label; 42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /templates/module/src/Command/console/translations/en/command.yml.twig: -------------------------------------------------------------------------------- 1 | description: 'Drupal Console generated command.' 2 | options: {} 3 | arguments: {} 4 | messages: 5 | success: 'I am a new generated command.' 6 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/core.entity_form_display.node.default.yml.twig: -------------------------------------------------------------------------------- 1 | langcode: en 2 | status: true 3 | dependencies: 4 | config: 5 | - field.field.node.{{ bundle_name }}.body 6 | - node.type.{{ bundle_name }} 7 | module: 8 | - path 9 | - text 10 | id: node.{{ bundle_name }}.default 11 | targetEntityType: node 12 | bundle: {{ bundle_name }} 13 | mode: default 14 | content: 15 | body: 16 | type: text_textarea_with_summary 17 | weight: 31 18 | settings: 19 | rows: 9 20 | summary_rows: 3 21 | placeholder: '' 22 | third_party_settings: { } 23 | created: 24 | type: datetime_timestamp 25 | weight: 10 26 | settings: { } 27 | third_party_settings: { } 28 | path: 29 | type: path 30 | weight: 30 31 | settings: { } 32 | third_party_settings: { } 33 | promote: 34 | type: boolean_checkbox 35 | settings: 36 | display_label: true 37 | weight: 15 38 | third_party_settings: { } 39 | sticky: 40 | type: boolean_checkbox 41 | settings: 42 | display_label: true 43 | weight: 16 44 | third_party_settings: { } 45 | title: 46 | type: string_textfield 47 | weight: -5 48 | settings: 49 | size: 60 50 | placeholder: '' 51 | third_party_settings: { } 52 | uid: 53 | type: entity_reference_autocomplete 54 | weight: 5 55 | settings: 56 | match_operator: CONTAINS 57 | size: 60 58 | placeholder: '' 59 | third_party_settings: { } 60 | hidden: { } 61 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/core.entity_view_display.node.default.yml.twig: -------------------------------------------------------------------------------- 1 | langcode: en 2 | status: true 3 | dependencies: 4 | config: 5 | - field.field.node.{{ bundle_name }}.body 6 | - node.type.{{ bundle_name }} 7 | module: 8 | - text 9 | - user 10 | id: node.{{ bundle_name }}.default 11 | targetEntityType: node 12 | bundle: {{ bundle_name }} 13 | mode: default 14 | content: 15 | body: 16 | label: hidden 17 | type: text_default 18 | weight: 101 19 | settings: { } 20 | third_party_settings: { } 21 | links: 22 | weight: 100 23 | hidden: { } 24 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/core.entity_view_display.node.teaser.yml.twig: -------------------------------------------------------------------------------- 1 | langcode: en 2 | status: true 3 | dependencies: 4 | config: 5 | - core.entity_view_mode.node.teaser 6 | - field.field.node.{{ bundle_name }}.body 7 | - node.type.{{ bundle_name }} 8 | module: 9 | - text 10 | - user 11 | id: node.{{ bundle_name }}.teaser 12 | targetEntityType: node 13 | bundle: {{ bundle_name }} 14 | mode: teaser 15 | content: 16 | body: 17 | label: hidden 18 | type: text_summary_or_trimmed 19 | weight: 101 20 | settings: 21 | trim_length: 600 22 | third_party_settings: { } 23 | links: 24 | weight: 100 25 | hidden: { } 26 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/entity-bundle-field-info-alter.php.twig: -------------------------------------------------------------------------------- 1 | 2 | {% block use_class %} 3 | use Drupal\Core\Entity\EntityTypeInterface; 4 | {% endblock %} 5 | 6 | /** 7 | * Implements hook_entity_bundle_field_info_alter(). 8 | */ 9 | function {{module}}_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) { 10 | {% if bundle %} 11 | if ($bundle === '{{ bundle }}') { 12 | {% endif %} 13 | if (isset($fields['{{ field_id }}'])) { 14 | // Use the ID as defined in the annotation of the constraint definition. 15 | $fields['{{ field_id }}']->addConstraint('{{ plugin_id }}', []); 16 | } 17 | {% if bundle %} 18 | } 19 | {% endif %} 20 | } -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/field.field.node.body.yml.twig: -------------------------------------------------------------------------------- 1 | langcode: en 2 | status: true 3 | dependencies: 4 | config: 5 | - field.storage.node.body 6 | - node.type.{{ bundle_name }} 7 | module: 8 | - text 9 | id: node.{{ bundle_name }}.body 10 | field_name: body 11 | entity_type: node 12 | bundle: {{ bundle_name }} 13 | label: Body 14 | description: '' 15 | required: false 16 | translatable: true 17 | default_value: { } 18 | default_value_callback: '' 19 | settings: 20 | display_summary: true 21 | field_type: text_with_summary 22 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Bundle/node.type.yml.twig: -------------------------------------------------------------------------------- 1 | langcode: en 2 | status: true 3 | dependencies: 4 | module: 5 | - menu_ui 6 | third_party_settings: 7 | menu_ui: 8 | available_menus: 9 | - main 10 | parent: 'main:' 11 | name: '{{ bundle_title }}' 12 | type: {{ bundle_name }} 13 | description: 'Generated by Drupal Console' 14 | help: '' 15 | new_revision: false 16 | preview_mode: 1 17 | display_submitted: true 18 | -------------------------------------------------------------------------------- /templates/module/src/Entity/Form/entity-content-delete.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Form\{{ entity_class }}DeleteForm. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Form; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Entity\ContentEntityDeleteForm; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides a form for deleting {{ label }} entities. 18 | * 19 | * @ingroup {{module}} 20 | */ 21 | class {{ entity_class }}DeleteForm extends ContentEntityDeleteForm {% endblock %} 22 | -------------------------------------------------------------------------------- /templates/module/src/Entity/entity-content-views-data.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Entity\{{ entity_class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Entity; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\views\EntityViewsData; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides Views data for {{ label }} entities. 18 | */ 19 | class {{ entity_class }}ViewsData extends EntityViewsData {% endblock %} 20 | {% block class_methods %} 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function getViewsData() { 25 | $data = parent::getViewsData(); 26 | 27 | // Additional information for Views integration, such as table joins, can be 28 | // put here. 29 | return $data; 30 | } 31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /templates/module/src/Entity/entity-content-with-bundle.theme.php.twig: -------------------------------------------------------------------------------- 1 | {% block hook_theme %} 2 | 3 | /** 4 | * Implements hook_theme(). 5 | */ 6 | function {{ module }}_theme() { 7 | $theme = []; 8 | {% include '/module/src/Entity/entity-content.theme.php.twig' with {'entity_name': entity_name, } %} 9 | $theme['{{ entity_name }}_content_add_list'] = [ 10 | 'render element' => 'content', 11 | 'variables' => ['content' => NULL], 12 | 'file' => '{{ entity_name }}.page.inc', 13 | ]; 14 | return $theme; 15 | } 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /templates/module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig: -------------------------------------------------------------------------------- 1 | {% block hook_theme_suggestions_hook %} 2 | 3 | /** 4 | * Implements hook_theme_suggestions_HOOK(). 5 | */ 6 | function {{ module }}_theme_suggestions_{{ entity_name }}(array $variables) { 7 | $suggestions = []; 8 | $entity = $variables['elements']['#{{ entity_name }}']; 9 | $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); 10 | 11 | $suggestions[] = '{{ entity_name }}__' . $sanitized_view_mode; 12 | $suggestions[] = '{{ entity_name }}__' . $entity->bundle(); 13 | $suggestions[] = '{{ entity_name }}__' . $entity->bundle() . '__' . $sanitized_view_mode; 14 | $suggestions[] = '{{ entity_name }}__' . $entity->id(); 15 | $suggestions[] = '{{ entity_name }}__' . $entity->id() . '__' . $sanitized_view_mode; 16 | return $suggestions; 17 | } 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /templates/module/src/Entity/entity-content.theme.php.twig: -------------------------------------------------------------------------------- 1 | {% block hook_theme %} 2 | $theme['{{ entity_name }}'] = [ 3 | 'render element' => 'elements', 4 | 'file' => '{{ entity_name }}.page.inc', 5 | 'template' => '{{ entity_name }}', 6 | ]; 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /templates/module/src/Entity/interface-entity.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Entity\{{ entity_class }}Interface. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Entity; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Config\Entity\ConfigEntityInterface; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides an interface for defining {{ label }} entities. 18 | */ 19 | interface {{ entity_class }}Interface extends ConfigEntityInterface {% endblock %} 20 | {% block class_methods %} 21 | // Add get/set methods for your configuration properties here.{% endblock %} 22 | -------------------------------------------------------------------------------- /templates/module/src/Form/entity-delete.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Form\{{ entity_class }}DeleteForm. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Form; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Entity\EntityConfirmFormBase; 13 | use Drupal\Core\Form\FormStateInterface; 14 | use Drupal\Core\Url; 15 | {% endblock %} 16 | 17 | {% block class_declaration %} 18 | /** 19 | * Builds the form to delete {{ label }} entities. 20 | */ 21 | class {{ entity_class }}DeleteForm extends EntityConfirmFormBase {% endblock %} 22 | {% block class_methods %} 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function getQuestion() { 27 | return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); 28 | } 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | public function getCancelUrl() { 34 | return new Url('entity.{{ entity_name }}.collection'); 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function getConfirmText() { 41 | return $this->t('Delete'); 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function submitForm(array &$form, FormStateInterface $form_state) { 48 | $this->entity->delete(); 49 | 50 | $this->messenger()->addMessage( 51 | $this->t('content @type: deleted @label.', [ 52 | '@type' => $this->entity->bundle(), 53 | '@label' => $this->entity->label(), 54 | ]) 55 | ); 56 | 57 | $form_state->setRedirectUrl($this->getCancelUrl()); 58 | } 59 | {% endblock %} 60 | -------------------------------------------------------------------------------- /templates/module/src/Generator/generator.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{extension}}\Generator\{{ class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{extension}}\Generator; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Console\Core\Generator\Generator; 13 | use Drupal\Console\Core\Generator\GeneratorInterface; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Class {{ class_name }}. 19 | * 20 | * @package Drupal\Console\Generator 21 | */ 22 | class {{ class_name }} extends Generator implements GeneratorInterface {% endblock %} 23 | 24 | {% block class_methods %} 25 | /** 26 | * {@inheritdoc} 27 | */ 28 | public function generate(array $parameters) { 29 | // Example how to render a twig template using the renderFile method 30 | // $this->renderFile( 31 | // 'path/to/file.php.twig', 32 | // 'path/to/file.php', 33 | // $parameters 34 | // );. 35 | } 36 | {% endblock %} 37 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/Block/blocktype.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\Block\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\Block; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Block\BlockBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | 17 | /** 18 | * {@inheritdoc} 19 | */ 20 | public function build() { 21 | $build = []; 22 | $build['{{block_id}}']['#markup'] = 'Implement {{class_name}}.'; 23 | return $build; 24 | } 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/CKEditorPlugin/plugin.php.twig: -------------------------------------------------------------------------------- 1 | /** 2 | * DO NOT EDIT THIS FILE. 3 | * See the following change record for more information, 4 | * https://www.drupal.org/node/2815083 5 | * @preserve 6 | **/ 7 | {% for button in buttons %} 8 | CKEDITOR.plugins.add('{{ plugin_id }}', { 9 | init: function( editor ) { 10 | if ( editor.ui.addButton ) { 11 | editor.ui.addButton( '{{ button.name }}', { 12 | label: 'default ckeditor button', 13 | id: '{{ button.name }}', 14 | command: '', 15 | toolbar: '{{ button.name }},10', 16 | } ); 17 | } 18 | } 19 | } ); 20 | {% endfor %} -------------------------------------------------------------------------------- /templates/module/src/Plugin/Condition/rulescondition.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\Condition\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\Condition; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\rules\Core\RulesConditionBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides a '{{class_name}}' condition. 18 | * 19 | * @Condition( 20 | * id = "{{plugin_id}}", 21 | * label = @Translation("{{label}}"), 22 | * category = @Translation("{{category}}"), 23 | {% if context %} 24 | * context = { 25 | {% for item in context %} 26 | * "{{ item.name }}" = @ContextDefinition("{{ item.type }}", 27 | * label = @Translation("{{ item.label }}"), 28 | * description = @Translation("{{ item.description }}") 29 | * ), 30 | {% endfor %} 31 | * } 32 | {% endif %} 33 | * ) 34 | */ 35 | class {{class_name}} extends RulesConditionBase {% endblock %} 36 | {% block class_methods %} 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function doEvaluate($object = NULL) { 41 | // Insert code here. 42 | } 43 | {% endblock %} -------------------------------------------------------------------------------- /templates/module/src/Plugin/ImageEffect/imageeffect.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\ImageEffect\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\ImageEffect; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Image\ImageInterface; 13 | use Drupal\image\ImageEffectBase; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Provides a '{{class_name}}' image effect. 19 | * 20 | * @ImageEffect( 21 | * id = "{{plugin_id}}", 22 | * label = @Translation("{{label}}"), 23 | * description = @Translation("{{description}}") 24 | * ) 25 | */ 26 | class {{ class_name }} extends ImageEffectBase {% endblock %} 27 | {% block class_methods %} 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function applyEffect(ImageInterface $image) { 32 | // Implement Image Effect. 33 | return imagefilter($image->getToolkit()->getResource()); 34 | } 35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/Mail/mail.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\Mail\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\Mail; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Mail\Plugin\Mail\PhpMail; 13 | {% if services is not empty %} 14 | use Drupal\Core\Plugin\ContainerFactoryPluginInterface; 15 | use Symfony\Component\DependencyInjection\ContainerInterface; 16 | {% endif %} 17 | {% endblock %} 18 | 19 | {% block use_class_services %} 20 | {% endblock %} 21 | 22 | {% block class_declaration %} 23 | /** 24 | * Provides a '{{class_name}}' mail plugin. 25 | * 26 | * @Mail( 27 | * id = "{{plugin_id}}", 28 | * label = @Translation("{{label}}") 29 | * ) 30 | */ 31 | class {{class_name}} extends PhpMail {% if services is not empty %}implements ContainerFactoryPluginInterface {% endif %} 32 | {% endblock %} 33 | 34 | {% block class_create %} 35 | {% if services is not empty %} 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { 40 | $instance = new static($configuration, $plugin_id, $plugin_definition); 41 | {{ serviceClassInjectionNoOverride(services) }} 42 | return $instance; 43 | } 44 | {% endif %} 45 | {% endblock %} 46 | 47 | {% block class_methods %} 48 | 49 | /** 50 | * {@inheritdoc} 51 | */ 52 | public function format(array $message) { 53 | } 54 | 55 | /** 56 | * {@inheritdoc} 57 | */ 58 | public function mail(array $message) { 59 | } 60 | {% endblock %} 61 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/QueueWorker/queue_worker.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block namespace_class %} 4 | namespace Drupal\{{ module }}\Plugin\QueueWorker; 5 | {% endblock %} 6 | 7 | {% block use_class %} 8 | use Drupal\Core\Queue\QueueWorkerBase; 9 | {% endblock %} 10 | 11 | {% block class_declaration %} 12 | /** 13 | * Plugin implementation of the {{ plugin_id }} queueworker. 14 | * 15 | * @QueueWorker ( 16 | * id = "{{ plugin_id }}", 17 | * title = @Translation("{{ label }}"), 18 | * cron = {"time" = {{ cron_time }}} 19 | * ) 20 | */ 21 | class {{ class_name }} extends QueueWorkerBase {% endblock %} 22 | {% block class_methods %} 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function processItem($data) { 27 | // Process item operations. 28 | } 29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/RulesAction/rulesaction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\RulesAction\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\RulesAction; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\rules\Core\RulesActionBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides a '{{class_name}}' action. 18 | * 19 | * @RulesAction( 20 | * id = "{{plugin_id}}", 21 | * label = @Translation("{{label}}"), 22 | * category = @Translation("{{category}}"), 23 | {% if context %} 24 | * context = { 25 | {% for item in context %} 26 | * "{{ item.name }}" = @ContextDefinition("{{ item.type }}", 27 | * label = @Translation("{{ item.label }}"), 28 | * description = @Translation("{{ item.description }}") 29 | * ), 30 | {% endfor %} 31 | * } 32 | {% endif %} 33 | * ) 34 | */ 35 | class {{class_name}} extends RulesActionBase {% endblock %} 36 | {% block class_methods %} 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function doExecute($object = NULL) { 41 | // Insert code here. 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function autoSaveContext() { 48 | // Insert code here. 49 | return []; 50 | } 51 | {% endblock %} 52 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/RulesDataProcessor/rulesdataprocessor.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | Drupal\{{module}}\Plugin\RulesDataProcessor\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\RulesDataProcessor; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Plugin\PluginBase; 13 | use Drupal\rules\Context\DataProcessorInterface; 14 | use Drupal\rules\Engine\ExecutionStateInterface; 15 | {% endblock %} 16 | 17 | {% block class_declaration %} 18 | /** 19 | * Provides a '{{class_name}}' action. 20 | * 21 | * @RulesDataProcessor( 22 | * id = "{{plugin_id}}", 23 | * label = @Translation("{{label}}") 24 | * ) 25 | */ 26 | class {{class_name}} extends PluginBase implements DataProcessorInterface {% endblock %} 27 | {% block class_methods %} 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function process($value, ExecutionStateInterface $rules_state) { 32 | // Insert code here. 33 | } 34 | {% endblock %} -------------------------------------------------------------------------------- /templates/module/src/Plugin/Validation/Constraint/constraint.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Plugin\Validation\Constraint\{{ class_name }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Plugin\Validation\Constraint; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Symfony\Component\Validator\Constraint; 13 | use Symfony\Component\Validator\ConstraintValidator; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Plugin implementation of the '{{ plugin_id }}'. 19 | * 20 | * @Constraint( 21 | * id = "{{ plugin_id }}", 22 | * label = @Translation("{{ label }}", context = "Validation"), 23 | * ) 24 | */ 25 | class {{ class_name }} extends Constraint 26 | {% endblock %} 27 | 28 | {% block class_properties %} 29 | // The message that will be shown if the value is empty. 30 | public $isEmpty = '%value is empty'; 31 | 32 | // The message that will be shown if the value is not unique. 33 | public $notUnique = '%value is not unique'; 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/Validation/Constraint/validator.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Plugin\Validation\Constraint\{{ class_name }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Plugin\Validation\Constraint; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Symfony\Component\Validator\Constraint; 13 | use Symfony\Component\Validator\ConstraintValidator; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Validates the UniqueInteger constraint. 19 | */ 20 | class {{ class_name }}Validator extends ConstraintValidator 21 | {% endblock %} 22 | 23 | {% block class_methods %} 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function validate($items, Constraint $constraint) { 28 | foreach ($items as $item) { 29 | // First check if the value is not empty. 30 | if (empty($item->value)) { 31 | // The value is empty, so a violation, aka error, is applied. 32 | // The type of violation applied comes from the constraint description 33 | // in step 1. 34 | $this->context->addViolation($constraint->isEmpty, ['%value' => $item->value]); 35 | } 36 | 37 | // Next check if the value is unique. 38 | if (!$this->isUnique($item->value)) { 39 | $this->context->addViolation($constraint->notUnique, ['%value' => $item->value]); 40 | } 41 | } 42 | } 43 | 44 | private function isUnique($value) { 45 | // Here is where the check for a unique value would happen. 46 | } 47 | {% endblock %} 48 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/migrate/process/process.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\migrate\process\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\migrate\process; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\migrate\ProcessPluginBase; 13 | use Drupal\migrate\MigrateExecutableInterface; 14 | use Drupal\migrate\Row; 15 | {% endblock %} 16 | 17 | {% block class_declaration %} 18 | /** 19 | * Provides a '{{class_name}}' migrate process plugin. 20 | * 21 | * @MigrateProcessPlugin( 22 | * id = "{{plugin_id}}" 23 | * ) 24 | */ 25 | class {{class_name}} extends ProcessPluginBase {% endblock %} 26 | {% block class_methods %} 27 | /** 28 | * {@inheritdoc} 29 | */ 30 | public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { 31 | // Plugin logic goes here. 32 | } 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/migrate/source/source.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\migrate\source\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\migrate\source; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\migrate\Plugin\migrate\source\SqlBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides a '{{class_name}}' migrate source. 18 | * 19 | * @MigrateSource( 20 | * id = "{{plugin_id}}", 21 | * source_module = "{{module}}" 22 | * ) 23 | */ 24 | class {{class_name}} extends SqlBase {% endblock %} 25 | {% block class_methods %} 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function query() { 30 | return $this->select('{{table}}', '{{alias}}') 31 | ->fields('{{alias}}') 32 | {% if group_by %} 33 | ->groupBy('{{alias}}.{{group_by}}') 34 | {% endif %}; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function fields() { 41 | $fields = [ 42 | {% for field in fields %} 43 | '{{field.id}}' => $this->t('{{field.description}}'), 44 | {% endfor %} 45 | ]; 46 | return $fields; 47 | } 48 | 49 | /** 50 | * {@inheritdoc} 51 | */ 52 | public function getIds() { 53 | return []; 54 | } 55 | {% endblock %} 56 | -------------------------------------------------------------------------------- /templates/module/src/Plugin/migrate_plus/data_parser/data_parser.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Plugin\migrate_plus\data_parser\{{class_name}}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Plugin\migrate_plus\data_parser; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\migrate_plus\DataParserPluginBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Provides a '{{class_name}}' data parser plugin. 18 | * 19 | * @DataParser( 20 | * id = "{{plugin_id}}" 21 | * title = @Translation("{{plugin_title}}") 22 | * ) 23 | */ 24 | class {{class_name}} extends DataParserPluginBase {% endblock %} 25 | {% block class_methods %} 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | protected function openSourceUrl($url) { 30 | // Plugin logic goes here. 31 | } 32 | 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | protected function fetchNextRow() { 37 | // Plugin logic goes here. 38 | } 39 | {% endblock %} 40 | -------------------------------------------------------------------------------- /templates/module/src/Routing/route-subscriber.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\Routing\{{ class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\Routing; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Routing\RouteSubscriberBase; 13 | use Symfony\Component\Routing\RouteCollection; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Class {{ class }}. 19 | * 20 | * Listens to the dynamic route events. 21 | */ 22 | class {{ class }} extends RouteSubscriberBase {% endblock %} 23 | {% block class_methods %} 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | protected function alterRoutes(RouteCollection $collection) { 28 | }{% endblock %} 29 | -------------------------------------------------------------------------------- /templates/module/src/Tests/js-test.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\Tests\{{ module }}\FunctionalJavascript\{{ class }} 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\Tests\{{ module }}\FunctionalJavascript; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\FunctionalJavascriptTests\JavascriptTestBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * JavaScript tests. 18 | * 19 | * @ingroup {{ module }} 20 | * 21 | * @group {{ module }} 22 | */ 23 | class {{ class }} extends JavaScriptTestBase {% endblock %} 24 | {% block class_methods %} 25 | /** 26 | * Modules to enable. 27 | * 28 | * @var array 29 | */ 30 | public static $modules = ['{{ module }}']; 31 | 32 | /** 33 | * A user with permission to administer site configuration. 34 | * 35 | * @var \Drupal\user\UserInterface 36 | */ 37 | protected $user; 38 | 39 | /** 40 | * {@inheritdoc} 41 | */ 42 | protected function setUp() { 43 | parent::setUp(); 44 | $this->user = $this->drupalCreateUser(['administer site configuration']); 45 | $this->drupalLogin($this->user); 46 | } 47 | 48 | /** 49 | * Tests that the home page loads with a 200 response. 50 | */ 51 | public function testFrontpage() { 52 | $this->drupalGet(Url::fromRoute('')); 53 | $page = $this->getSession()->getPage(); 54 | $this->assertSession()->statusCodeEquals(200); 55 | } 56 | {% endblock %} 57 | -------------------------------------------------------------------------------- /templates/module/src/Tests/load-test.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\Tests\{{ machine_name }}\Functional\LoadTest 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\Tests\{{ machine_name }}\Functional; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Url; 13 | use Drupal\Tests\BrowserTestBase; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Simple test to ensure that main page loads with module enabled. 19 | * 20 | * @group {{ machine_name }} 21 | */ 22 | class LoadTest extends BrowserTestBase {% endblock %} 23 | {% block class_methods %} 24 | /** 25 | * Modules to enable. 26 | * 27 | * @var array 28 | */ 29 | public static $modules = ['{{ machine_name }}']; 30 | 31 | /** 32 | * A user with permission to administer site configuration. 33 | * 34 | * @var \Drupal\user\UserInterface 35 | */ 36 | protected $user; 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | protected function setUp() { 42 | parent::setUp(); 43 | $this->user = $this->drupalCreateUser(['administer site configuration']); 44 | $this->drupalLogin($this->user); 45 | } 46 | 47 | /** 48 | * Tests that the home page loads with a 200 response. 49 | */ 50 | public function testLoad() { 51 | $this->drupalGet(Url::fromRoute('')); 52 | $this->assertSession()->statusCodeEquals(200); 53 | } 54 | {% endblock %} 55 | -------------------------------------------------------------------------------- /templates/module/src/cache-context.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\CacheContext; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Cache\CacheableMetadata; 13 | use Drupal\Core\Cache\Context\CacheContextInterface; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Class {{ class }}. 19 | */ 20 | class {{ class }} implements CacheContextInterface {% endblock %} 21 | 22 | {% block class_construct %} 23 | 24 | /** 25 | * Constructs a new {{ class }} object. 26 | */ 27 | public function __construct({{ servicesAsParameters(services)|join(', ') }}) { 28 | {{ serviceClassInitialization(services) }} 29 | } 30 | 31 | {% endblock %} 32 | 33 | {% block class_methods %} 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public static function getLabel() { 38 | \Drupal::messenger()->addMessage('Lable of cache context'); 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function getContext() { 45 | // Actual logic of context variation will lie here. 46 | } 47 | 48 | /** 49 | * {@inheritdoc} 50 | */ 51 | public function getCacheableMetadata() { 52 | return new CacheableMetadata(); 53 | } 54 | {% endblock %} 55 | -------------------------------------------------------------------------------- /templates/module/src/entity-listbuilder.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ entity_class }}ListBuilder. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Config\Entity\ConfigEntityListBuilder; 13 | use Drupal\Core\Entity\EntityInterface; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Provides a listing of {{ label }} entities. 19 | */ 20 | class {{ entity_class }}ListBuilder extends ConfigEntityListBuilder {% endblock %} 21 | {% block class_methods %} 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public function buildHeader() { 26 | $header['label'] = $this->t('{{ label }}'); 27 | $header['id'] = $this->t('Machine name'); 28 | return $header + parent::buildHeader(); 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function buildRow(EntityInterface $entity) { 35 | $row['label'] = $entity->label(); 36 | $row['id'] = $entity->id(); 37 | // You probably want a few more properties here... 38 | return $row + parent::buildRow($entity); 39 | } 40 | {% endblock %} 41 | -------------------------------------------------------------------------------- /templates/module/src/entity-route-provider.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\{{ entity_class }}HtmlRouteProvider. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Entity\EntityTypeInterface; 13 | use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Provides routes for {{ label }} entities. 19 | * 20 | * @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider 21 | * @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider 22 | */ 23 | class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endblock %} 24 | {% block class_methods %} 25 | /** 26 | * {@inheritdoc} 27 | */ 28 | public function getRoutes(EntityTypeInterface $entity_type) { 29 | $collection = parent::getRoutes($entity_type); 30 | 31 | // Provide your custom entity routes here. 32 | return $collection; 33 | } 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /templates/module/src/entity-translation-handler.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block namespace_class %} 4 | namespace Drupal\{{module}}; 5 | {% endblock %} 6 | 7 | {% block use_class %} 8 | use Drupal\content_translation\ContentTranslationHandler; 9 | {% endblock %} 10 | 11 | {% block class_declaration %} 12 | /** 13 | * Defines the translation handler for {{ entity_name }}. 14 | */ 15 | class {{ entity_class }}TranslationHandler extends ContentTranslationHandler {% endblock %} 16 | {% block class_methods %} 17 | // Override here the needed methods from ContentTranslationHandler. 18 | {%- endblock -%} -------------------------------------------------------------------------------- /templates/module/src/event-subscriber.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}\EventSubscriber; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; 13 | use Symfony\Component\EventDispatcher\Event; 14 | {% endblock %} 15 | 16 | {% block class_declaration %} 17 | /** 18 | * Class {{ class }}. 19 | */ 20 | class {{ class }} implements EventSubscriberInterface {% endblock %} 21 | 22 | {% block class_construct %} 23 | /** 24 | * Constructs a new {{ class }} object. 25 | */ 26 | public function __construct({{ servicesAsParameters(services)|join(', ') }}) { 27 | {{ serviceClassInitialization(services) }} 28 | } 29 | 30 | {% endblock %} 31 | 32 | {% block class_methods %} 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | public static function getSubscribedEvents() { 37 | {% for event_name, callback in events %} 38 | $events['{{ event_name }}'] = ['{{ callback }}']; 39 | {% endfor %} 40 | 41 | return $events; 42 | } 43 | {% for event_name, callback in events %} 44 | 45 | /** 46 | * This method is called when the {{ event_name }} is dispatched. 47 | * 48 | * @param \Symfony\Component\EventDispatcher\Event $event 49 | * The dispatched event. 50 | */ 51 | public function {{ callback }}(Event $event) { 52 | \Drupal::messenger()->addMessage('Event {{ event_name }} thrown by Subscriber in module {{ module }}.', 'status', TRUE); 53 | } 54 | {% endfor %} 55 | {% endblock %} 56 | -------------------------------------------------------------------------------- /templates/module/src/listbuilder-entity-content.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ entity_class }}ListBuilder. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}}; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Entity\EntityInterface; 13 | use Drupal\Core\Entity\EntityListBuilder; 14 | use Drupal\Core\Link; 15 | {% endblock %} 16 | 17 | {% block class_declaration %} 18 | /** 19 | * Defines a class to build a listing of {{ label }} entities. 20 | * 21 | * @ingroup {{ module }} 22 | */ 23 | class {{ entity_class }}ListBuilder extends EntityListBuilder {% endblock %} 24 | 25 | {% block class_methods %} 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function buildHeader() { 30 | $header['id'] = $this->t('{{ label }} ID'); 31 | $header['name'] = $this->t('Name'); 32 | return $header + parent::buildHeader(); 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | public function buildRow(EntityInterface $entity) { 39 | /* @var \Drupal\{{module}}\Entity\{{ entity_class }} $entity */ 40 | $row['id'] = $entity->id(); 41 | $row['name'] = Link::createFromRoute( 42 | $entity->label(), 43 | 'entity.{{ entity_name }}.edit_form', 44 | ['{{ entity_name }}' => $entity->id()] 45 | ); 46 | return $row + parent::buildRow($entity); 47 | } 48 | {% endblock %} 49 | -------------------------------------------------------------------------------- /templates/module/src/plugin-type-annotation-base.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Plugin\{{ class_name }}Base. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Plugin; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Component\Plugin\PluginBase; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Base class for {{ label }} plugins. 18 | */ 19 | abstract class {{ class_name }}Base extends PluginBase implements {{ class_name }}Interface {% endblock %} 20 | {% block class_methods %} 21 | 22 | // Add common methods and abstract methods for your plugin type here. 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /templates/module/src/plugin-type-annotation-interface.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Plugin\{{ class_name }}Interface. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Plugin; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Component\Plugin\PluginInspectionInterface; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Defines an interface for {{ label }} plugins. 18 | */ 19 | interface {{ class_name }}Interface extends PluginInspectionInterface {% endblock %} 20 | {% block class_methods %} 21 | 22 | // Add get/set methods for your plugin type here. 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /templates/module/src/plugin-type-annotation-manager.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\Plugin\{{ class_name }}Manager. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}\Plugin; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Core\Plugin\DefaultPluginManager; 13 | use Drupal\Core\Cache\CacheBackendInterface; 14 | use Drupal\Core\Extension\ModuleHandlerInterface; 15 | {% endblock %} 16 | 17 | {% block class_declaration %} 18 | /** 19 | * Provides the {{ label }} plugin manager. 20 | */ 21 | class {{ class_name }}Manager extends DefaultPluginManager {% endblock %} 22 | {% block class_methods %} 23 | 24 | /** 25 | * Constructs a new {{ class_name }}Manager object. 26 | * 27 | * @param \Traversable $namespaces 28 | * An object that implements \Traversable which contains the root paths 29 | * keyed by the corresponding namespace to look for plugin implementations. 30 | * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend 31 | * Cache backend instance to use. 32 | * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler 33 | * The module handler to invoke the alter hook with. 34 | */ 35 | public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { 36 | parent::__construct('Plugin/{{ class_name }}', $namespaces, $module_handler, 'Drupal\{{ module }}\Plugin\{{ class_name }}Interface', 'Drupal\{{ module }}\Annotation\{{ class_name }}'); 37 | 38 | $this->alterInfo('{{ module }}_{{ machine_name }}_info'); 39 | $this->setCacheBackend($cache_backend, '{{ module }}_{{ machine_name }}_plugins'); 40 | } 41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /templates/module/src/service-interface.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/interface.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ interface }}. 5 | {% endblock %} 6 | 7 | {% block namespace_interface %} 8 | namespace Drupal\{{module}}; 9 | {% endblock %} 10 | 11 | {% block interface_declaration %} 12 | /** 13 | * Interface {{ interface }}. 14 | */ 15 | interface {{ interface }} {% endblock %} 16 | -------------------------------------------------------------------------------- /templates/module/src/service.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{module}}\{{ class }}. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{module}};{% endblock %} 9 | 10 | {% block class_declaration %} 11 | /** 12 | * Class {{ class }}. 13 | */ 14 | class {{ class }}{% if(interface is defined and interface) %} implements {{ interface }}{% endif %} {% endblock %} 15 | {% block class_construct %} 16 | /** 17 | * Constructs a new {{ class }} object. 18 | */ 19 | public function __construct({{ servicesAsParameters(services)|join(', ') }}) { 20 | {{ serviceClassInitialization(services) }} 21 | } 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /templates/module/src/yaml-plugin-manager-interface.php.twig: -------------------------------------------------------------------------------- 1 | {% extends "base/class.php.twig" %} 2 | 3 | {% block file_path %} 4 | \Drupal\{{ module }}\{{ class_name }}ManagerInterface. 5 | {% endblock %} 6 | 7 | {% block namespace_class %} 8 | namespace Drupal\{{ module }}; 9 | {% endblock %} 10 | 11 | {% block use_class %} 12 | use Drupal\Component\Plugin\PluginManagerInterface; 13 | {% endblock %} 14 | 15 | {% block class_declaration %} 16 | /** 17 | * Defines an interface for {{ plugin_name }} managers. 18 | */ 19 | interface {{ class_name }}ManagerInterface extends PluginManagerInterface {% endblock %} 20 | {% block class_methods %} 21 | // Add getters and other public methods for {{ plugin_name }} managers. 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /templates/module/templates/entity-html.twig: -------------------------------------------------------------------------------- 1 | {{ '{#' }} 2 | /** 3 | * @file {{ entity_name }}.html.twig 4 | * Default theme implementation to present {{ label }} data. 5 | * 6 | * This template is used when viewing {{ label }} pages. 7 | * 8 | * 9 | * Available variables: 10 | * - content: A list of content items. Use 'content' to print all content, or 11 | * - attributes: HTML attributes for the container element. 12 | * 13 | * @see template_preprocess_{{ entity_name }}() 14 | * 15 | * @ingroup themeable 16 | */ 17 | {{ '#}' }} 18 | 19 | {{ '{%' }} if content {{ '%}' }} 20 | {{ '{{' }}- content -{{ '}}' }} 21 | {{ '{%' }} endif {{ '%}' }} 22 | 23 | -------------------------------------------------------------------------------- /templates/module/templates/entity-with-bundle-content-add-list-html.twig: -------------------------------------------------------------------------------- 1 | {{ '{#' }} 2 | /** 3 | * @file 4 | * Default theme implementation to present a list of custom content entity types/bundles. 5 | * 6 | * Available variables: 7 | * - types: A collection of all the available custom entity types/bundles. 8 | * Each type/bundle contains the following: 9 | * - link: A link to add a content entity of this type. 10 | * - description: A description of this content entity types/bundle. 11 | * 12 | * @see template_preprocess_{{ entity_name }}_content_add_list() 13 | * 14 | * @ingroup themeable 15 | */ 16 | {{ '#}' }} 17 | {{ '{%' }} spaceless {{ '%}' }} 18 |
19 | {{ '{%' }} for type in types {{ '%}' }} 20 |
{{ '{{' }} type.link {{ '}}' }}
21 | {{ '{%' }} endfor {{ '%}' }} 22 |
23 | {{ '{%' }} endspaceless {{ '%}' }} 24 | -------------------------------------------------------------------------------- /templates/module/templates/plugin-block-html.twig: -------------------------------------------------------------------------------- 1 | {{ '{#' }} 2 | /** 3 | * @file 4 | * Default theme implementation to display a block. 5 | * 6 | * @see template_preprocess_block() 7 | * 8 | * @ingroup themeable 9 | */ 10 | {{ '#}' }} 11 | {{ "{% set classes = [ 12 | 'clear-both', 13 | ] %}" }} 14 | 15 | {{ '{% for value in content %}' }} 16 | {{ '

{{value}}

' }} 17 | {{ '{% endfor %}' }} 18 | 19 | -------------------------------------------------------------------------------- /templates/module/twig-template-file.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /templates/module/update.php.twig: -------------------------------------------------------------------------------- 1 | {% block file_methods %} 2 | {% if not file_exists %} 3 | {% include 'module/php_tag.php.twig' %} 4 | {% endif %} 5 | /** 6 | * Implements hook_update_N() on Module {{ module }} Update # {{ update_number }}. 7 | */ 8 | function {{ module }}_update_{{ update_number }}(&$sandbox) { 9 | \Drupal::messenger()->addMessage('Module {{ module }} Update # {{ update_number }} () was executed successfully.'); 10 | } 11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /templates/profile/info.yml.twig: -------------------------------------------------------------------------------- 1 | name: {{ profile }} 2 | type: {{ type }} 3 | description: '{{ description }}' 4 | core: {{ core }} 5 | {% if distribution %} 6 | 7 | distribution: 8 | name: '{{ distribution }}' 9 | {% endif %} 10 | {% if dependencies %} 11 | 12 | dependencies: 13 | {% for dependency in dependencies %} 14 | - '{{ dependency }}' 15 | {% endfor %} 16 | {% endif %} 17 | {% if themes %} 18 | 19 | themes: 20 | {% for theme in themes %} 21 | - '{{ theme }}' 22 | {% endfor %} 23 | {% endif %} 24 | -------------------------------------------------------------------------------- /templates/profile/install.twig: -------------------------------------------------------------------------------- 1 |