Delete Drupal View programatically

Quick function to delete a view.

This is basically what the UI form submit does.

<?php
function delete_view($name) {

   
$view = views_ui_cache_load($name);
   
$view->delete();
   
views_object_cache_clear('view', $view->name);

}
?>

Read more

Drupal - the missing API

I was just reading this presentation on deploying Drupal

http://www.slideshare.net/eaton/drupal-deployment-presentation

and noticed

http://drupal.org/project/install_profile_api

Which seems to have a collection of API functions needed at install/upgrade time that are missing from Drupal (and contrib modules)

And even better this is great motivation to write more such functions myself instead of just using SQL hacks.

Read more

Drupal has no API

I've been using Drupal for a couple of years now, and know my way around it pretty well.

One of my biggest frustrations though is that it doesn't really have an API.

Much of the functionality is only really available through the application, you can do things pretty easily by pointing and clicking, but try and automate part of this and you have to step through code, find form handlers, copy-paste parts of the functions and work out what parameters are required.

The example I found most recently was creating a translated version of a page.

Read more