开发者

Drupal Module Development : Uninstall/Reinstall/Repeat?

I'm developing a custom module for Drupal on my local machine.

When I edit my code, the changes are never applied 开发者_开发百科right away. So, I go to Administer Modules, and uninstall, and then reinstall my module. This is cycle of uninstall-install-develop-repeat is slow and tedious.

Is there a better way to do it?

My module makes extensive use of Drupal framework so I'm not sure developing it exclusively in PHP first is an option.


I would highly recommend installing the Devel module. It is very useful while developing for Drupal. Once installed, you can enable the Devel block which is extremely useful. It has a list of links to perform somewhat tedious tasks faster, such as emptying the cache, reinstalling modules, rebuilding the menus, etc.

Many of the changes to your module should not require visiting the modules page. You mostly see the need to do this when you are changing the menu with hook_menu() in your module, as the menus are only rebuilt when visiting that page (or using Devel block "Rebuild Menus" link ;) )


When uninstall/install, the only things that is executed is what is in .install file.

If you don't change this file, you don't have to uninstall/install the module.

Maybe your problem is just a cache issue. Drupal strongly cache a lot a things. And when you enable a module, the cache is cleared. You can clear you cache manually.

On an other hand, I recommand to look on Drush that allow you to do those things faster. (clear cache, enable/disable a module/...)


The Drupal admin menu (http://drupal.org/project/admin_menu) along with devel comes in very handy if you have to flush caches.


Just drop cache on each time when you edit your code

Administer->Site perfomance


How can re-install module using Drush commands ?
Run command
drush dre cars_api
For details visit
https://drushcommands.com/drush-9x/devel/devel:reinstall/

======================== Drush For Drupal ========================

What is Drush ?
Ans : Drush is a command line shell and scripting interface for Drupal,
and it is work like Laravel-Artisan, and Angular CLi etc.
It is very Help-full for fast development on Drupal.
Official Website -> http://www.drush.org/
Official composer repository -> https://packagist.org/packages/drush/drush#dev-master
Official Drupal Repository -> https://www.drupal.org/project/drush

What is the Installation Process ?
Ans : There is following steps.
1.Step
Install new and latest version of composer
2. Step
Run in vscode Terminal
composer global require drush/drush:9.x-dev
check the installation in terminal via following command
drush version
For more details visit
https://packagist.org/packages/drush/drush#dev-master
And also helpful
http://docs.drush.org/en/master/
3. Step
Visite following link and see Drush All conads details and documentation
https://drushcommands.com/drush-9x/
https://www.drupal.org/docs/user_guide/en/prevent-cache-clear.html

How can resolve Drush Errors ?
Run command in vscode terminal
Composer require drush/drush

How can see drush commands list in terminal ?
Just type in vscode terminal in project dir
Drush

and enter
So all commands will be listed with summary

Uninstallation process for Drush ?
Just change in command ‘require’ to ‘remove’
composer global remove drush/drush:9.x-dev

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜