i want to create a module on drupal 9 - forms

I'm a junior developper and I want to create a module on drupal 9, but I don't know where to start... I was thinking about create a module that says "hello world" just to understand how it works.
Can I have some help ? :)
Thanks,
Mélissandre
I've already installed a module on drupal 7 : yakforms. I saw that it was not migrated to drupal 9 because it is based on another module : formbuilder that is not migrated either, so I want to do it by myself. But first of all I need to understand how to create a module !

Try resources such as:
https://www.drupal.org/docs/creating-modules
https://www.youtube.com/watch?v=mHTuXXfBs7Y
https://www.youtube.com/watch?v=OBuOFAca4kM
Or try using drush to generate code, someting like:
drush generate module

Related

How can I make inherits of postgresql by migration in laravel 5.2?

I want yo make tables in postgresql with inherits, I foundes this http://packalyst.com/packages/package/thibaud-dauce/postgresql-schema form laravel 4.2, but it does not work whith laravel 5.2.
It shows me:
[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class ThibaudDauce\PostgresqlSchema\PostgresqlSchemaServiceProvider' not found
when i try with composer update.
Could you help me please?
You can pull in this package https://packagist.org/packages/rishi-ramawat/laravel-postgresql-inherit via composer like this for using it with Laravel 5.2.* & 5.3.* :
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.1.0"
This is a package which I maintain and it currently supports Laravel 5.2.*, 5.3.* & 5.4.*
For Laravel 5.4.* you would have to do:
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.2"
Please read the README of this package to find out more about the complete installation procedure.
You may run it:
DB::statement("ALTER TABLE capitals INHERIT cities;");

laravel 5 ide autocompletion

I want to switch to laravel 5, but have some trouble with ide - autocompletion. I'm using phpstorm.
In google, the answers always end up with suggesting to use https://github.com/barryvdh/laravel-ide-helper . But it seems like it is broken for Laravel 5.
The steps I am doing are:
Install Laravel 5
composer create-project laravel/laravel
Require ide-helper
composer require barryvdh/laravel-ide-helper
Added 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
....
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
Trying to generate the helper file
artisan ide-helper:generate
But it always breaks with following error:
exception 'InvalidArgumentException' with message 'There are no commands defined in the "ide-helper" namespace.' in C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php:501
0 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(535): Symfony\Component\Console\Application->findNamespace('ide-helper')
1 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console
\Application.php(192): Symfony\Component\Console\Application->find('ide-helper:gene...')
2 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Outpu
t\ConsoleOutput))
3 C:\xampp\htdocs\test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Out
put\ConsoleOutput))
4 C:\xampp\htdocs\test\artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
5 {main}
Maybe someone had the same issue and can help me.
I'm open for different solutions for autocompletion other than barryvdh's ide-helper.
I had the same problem and this fixed it:
Before you run php artisan ide-helper:generate command, make sure to php artisan clear-compiled and php artisan optimize as it's noted here. If this didn't fixed your problem, take a look at this and clean out PhpStorm cache by choosing this:
File | Invalidate Caches/Restart
After auto restarting, PhpStorm will index again and everything should work fine.
Sorry for my bad english.
Edited: After these steps import your Facades like this use Illuminate\Support\Facades\Auth link them inside your _ide_helper.php file like use Auth.
I ran into the same problem. These are the steps I took to fix it:
I double-checked that 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' was correctly added to the providers array in config/app.php.
I executed artisan clear-compiled. Had no effect
Executing php artisan config:clear fixed the problem.
This error occur when the package ServiceProvider isn't loaded.
If you have multiple config file (like for different environment), you must ensure that the service provider is well set in all the environment you which to use the package.
config/
local/
app.php
app.php
to verify if the service provider is correctly set to your application you can dump the app config:
dd(\Config::get('app.providers'));
Try this:
php artisan ide-helper:generate
Here is an updated gist as of this month. I have tested this and it works in PHPStorm.
Also you don't have to install this through composer. Copy the gist and save it in your root folder as _ide_helper.php.

Can I use Eclipse XQDT to debug Marklogic modules/xquery?

Hi Markloggers out there,
I am working now a coupe of months with Marklogic, developping xquery, modules, applications on the ML app server etc etc. I use eclipse a lot, I have XQDT up and running for several marklogic servers. We use the console also.
What I miss is a debug functionality... in Eclispe with XQDT I cannot get the debug function working?
What I need is a nice and clean way to quickly test and develop modelules and functions...
This is my basic lib from the ML example documentation:
xquery version "1.0-ml";
module namespace lib = 'http://www.example.com/lib';
declare function lib:user()
{
xdmp:get-current-user()
};
I have this is my XQDT project in eclipse, I have setup a marklogic XDBC server locally and it works ok.
Now I want to use the above module from a file again in the XQDT project in eclipse. But without going to steps of uploading the module to the db etc etc...:
(: XQuery main module :)
import module namespace lib = 'http://www.example.com/lib' at 'lib.xq';
lib:user()
Gives:
XDMP-MODNOTFOUND: (err:XQST0059) Module /lib.xq not found
Question 1: Is there a way to find the module without putting it in a module root? In the docs it says from a XQDT project I could source a module but I cannot get it to work...
Question 2: I can execute arbitrary xquery to the local Marklogic server but if I set a debug flag anywhere in a xgy file in the XQDT project and press the debug button I get a popup saying "The Debug Engine is not properly configured". Can anyone explain to me if it is possible to use the debug option in eclipse XQDT with Marklogic 7 ?
Regards,
hugo
It's best to limit yourself to one question per SO post. After all you can only accept one answer.
Now I want to use the above module from a file again in the XQDT
project in eclipse. But without going to steps of uploading the module
to the db etc
That's a problem. You can evaluate an ad-hoc query directly. But if it references a library module, that library module needs to be available to the server. You're going to have to copy it to the server sooner or later anyhow, so do it sooner. I don't use an IDE myself, but can't you set it up to do that for you?
Question 1: Is there a way to find the module without putting it in a module root?
Not in the broadest sense of "module root", no. The docs at https://docs.marklogic.com/guide/app-dev/import_modules talk about how this works. Somehow or other, you need to make the library module available to MarkLogic.
I can't address your last question. I don't use an IDE, and even if I did I probably wouldn't use a debugger. Instead I xdmp:log messages to ErrorLog.txt, and occasionally I'll plant an breakpoint-like error() call in my code.

Error with the ZF tool while setting up the GuestBook Application

Iam trying to set up the GuestBook Application which comes with zend framework tutorial , Iam following the steps one by one,
However when I enter this command - zf create db-table Guestbook guestbook
Iam getting an error, I have pasted the error here -
C:\xampp\htdocs\quickstart>zf create db-table Guestbook guestbook
An Error Has Occurred Provider 'db-table' is not a valid provider.
I tried googling and searching on zend forums, but seems no one got this sort of issue so far. Can anyone suggest me whats wrong here?
PS: I have set php in my system path and zf tool works for me, its only this specific command thats giving error.
After Lots of digging in and breaking my head with the ZF tool I found that it is using copy of Zend framework which comes with Xampp for Windows.
When I installed Xampp, Zend Framework(Version 1.9.7) got installed inside the
C:\Xampp\Php\Pear\Zend
directory and since C:\Xampp\Php is in my system path this Zend framework got picked up everytime by Zend Tool.
I copied the latest version of stable Zend Framework(1.10.2) to the Zend folder inside Php\Pear and now its works like cake for me :)
Thanks for all your suggestions!
Download latest version of framework files from this link http://www.zend.com/community/downloads & then extract zip file where you will get folder structure like ZendFramework-1.11.12/library/Zend, So from this folder copy Zend folder to Xampp/php/PEAR/zend folder. Then Go to command mode type Zf --help. Now it shows all the commands.
Now also check version of zend-framework in command mode by typing as
zf show version
it should show as version as zend Framework Version: 1.11.12
Check your version, maybe db-table is newer than your version. I just tried the same command you used (zf create db-table Guestbook guestbook) and it worked.
When i write zf show version it responds 1.11.0dev. What does your version say? If it's low, consider updating after following the changelog and testing the rest of your application with the new version of zf.

Problems with zend-tool reporting that providers are not valid

I have recently setup XAMPP 1.7.3 and ZendFramework 1.10.4 on a new computer and many of the commands that I normally use now fail.
Here are the steps I used to setup and test ZF.
First I added the ZF library folder (C:\xampp\php\ZendFramework-1.10.4\library) to the include path in php.ini.
Then I added the ZF bin folder (C:\xampp\php\ZendFramework-1.10.4\bin) to my Path system variable.
To test that everything is configured correctly I ran the command "zf show version" from the command line. The result is "Zend Framework Version: 1.9.6".
Immediately something appears to be wrong. The file that is downloaded is "ZendFramework-1.10.4.zip" and the reported version is 1.9.6. I have re-downloaded the latest version (1.10.4) and removed old copy. Still the incorrect version number problem persisted.
Having done some research there is a bug in the ZF knowledgebase that version 1.10.3 reports a wrong version number. So that may explain the version number problem.
Moving forward I tried to run some zf-tool commands and certain commands reports that the action or provider is not valid.
Example:
C:\xampp\htdocs>zf create project test
Creating project at C:/xampp/htdocs/test
C:\xampp\htdocs>cd test
C:\xampp\htdocs\test>zf create controller Test
Creating a controller at C:\xampp\htdocs\test/application/controllers/TestController.php
...
Updating project profile 'C:\xampp\htdocs\test/.zfproject.xml'
C:\xampp\htdocs\test>zf create action test Test
Creating an action named test inside controller at C:\xampp\htdocs\test/application/controllers/TestController.php
...
Updating project profile 'C:\xampp\htdocs\test/.zfproject.xml'
C:\xampp\htdocs\test>zf enable layout
An Error Has Occurred
Action 'enable' is not a valid action.
...
C:\xampp\htdocs\test>zf create form Test
An Error Has Occurred
Provider 'form' is not a valid provider.
...
Can any one provide insight into these errors and how to correct them?
I had a similar issue, it turned out that I needed to manually update the zf.bat and zf.php files that came included with xampp after updating to the latest zend framework.
I got them from the zend svn here: http://framework.zend.com/svn/framework/standard/trunk/bin/
the simple way if you are using xampp, just go to the path "xampp\php\PEAR" an replace the older Zend directory with all included files by a new one zend 1.10... dir and your porblems are lost :)
i think your problem is, that Zend Tool is shipped with xampp since some versions.
Try to find zf.bat in your Xampp directory and remove it ;)
ZF friends have written the worst kind of docs. For XAMPP user, it is more difficult. I have learning ZF and posting error getting on the path. I am also using XAMPP.
Your error list is very big. I hope I can help you.
Solution for error "An Error Has Occurred
Action 'enable' is not a valid action." is XAMPP's Zend Tool installation. Delete that.
Check here for more details about the solution and other possible errors: http://www.satya-weblog.com/2010/11/zend-framework-creating-layout.html.