D7 ctools - pierregermain/MyDrupal GitHub Wiki
Exportable objects with drush ctools
This has been tested under drush8 but if you need to select specific objects you will need to use:
- drush 7
- PHP 5.6
And still, the part to select objects didn't work well in my case.
List of drush commands
$ drush8 | grep ctools
CTools commands: (ctools)
ctools-export (ctex) Export multiple CTools exportable objects directly to code.
ctools-export-disable (cted) Disable CTools exportables.
ctools-export-enable (ctee) Enable CTools exportables.
ctools-export-info (ctei) Show available CTools exportable objects.
ctools-export-revert (cter) Revert CTools exportables from changes overridden in the database.
ctools-export-view (ctev) View CTools exportable object code output.
Get overview of exportables
$ drush8 ctools-export-info
You will see the following objects to be managed:
- views (
views_view
) - display suite
- panels
To disable all views:
drush8 ctools-export-disable views_view
To enable all views:
$ drush8 ctools-export-enable views_view
To enable or disable one view:
$ drush8 ctools-export-enable views_view ultimo_articulo
$ drush8 ctools-export-disable views_view ultimo_articulo
Configuración de Vistas
Desde http://drupal-7.loc/admin/structure/views podemos ver que una vista a nivel de configuraciones puede tener varios estados:
- Database overriding code
- In database
- In code
Si queremos dejar una vista tal cómo estaba (In code) podemos hacer lo siguiente
$ drush8 ctools-export-revert views_view frontpage
See the code from a view
$ drush8 ctools-export-view views_view ultimo_articulo
Export the code from a view to code
$ drush8 help ctools-export
drush8 ctools-export export_module
By default it will export all your exportable objects to a module called "export_module"
Enabling your exportable objects
As you can see, our view called ultimo_articulo is in the following state: In database
If we enable our exported module with drush8 en export_module
we will see that our view will now be in the following state: Database overriding code
.
drush en export_module