I've been working on an add on module for Zenophile that adds some additional features, and while hook_form_alter gets me half of the way there, it would be wonderful if there was a zenophile hook after it generates the sub-theme that other modules could use to basically append to the *-fresh.css file with whatever they need to.

I imagine an add on module would do something like:

<?php
/**
* Implementation of hook_zenophile_created()
*/

zenophile_extras_zenophile_created ($dir, $sysname, $form)
{
  // do something
}
?>

Not sure <em>exactly</em> what would be the best implementation, but for now to get my customizations to fire appropriately I have to duplicate a lot of what happens in the <code>zenophile_create_submit

function to apply my customizations and get the appropriate information.

Comments

elliotttt’s picture

Woops, sorry about the above formatting, I left a </code> out of there :P

Garrett Albright’s picture

Assigned: Unassigned » Garrett Albright

Yes. This should happen one way or another…

elliotttt’s picture

Thought I'd post a follow up, perhaps this specific functionality doesn't warrant the need for an API just yet ;)

In my add on module I'm doing a hook_form_alter and adding a new field-set. I've also appended a new submit callback:
<?php $form['#submit'][] = 'zenophile_extras_submit'; ?>.

In my zenophile_extras_submit function, it fires after the original form submission callback, and I seem to have access to everything my add on module needs by simply copying:

<?php
$dir = "sites/{$form_state['values']['site']}/themes/{$form_state['values']['sysname']}";
  $parent_dir = drupal_get_path('theme', $form_state['values']['parent']);
  $zen_dir = drupal_get_path('theme', 'zen');
  $parent_info = $form_state['values']['parent'] . '.info';
  $parent_css = $form_state['values']['parent'] . '.css';
  $path_part = "{$dir}/{$form_state['values']['sysname']}";
?>

So far, so good, I'm able to create new files in the newly created sub-theme folder, and I imagine adding a line or two to the info file won't be that difficult.

Garrett Albright’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

When the packaging robot packages up a new dev release of the 2.0 branch, give it a download. Its API pretty much consists of a single function, but it ought to be powerful enough to do just about anything you need it to. A new module included with it called Zenophile Midnight (which replaces my Zen Midnight theme) is a functional example of an add-on module you can write with the API; check out its source for the goods.

Garrett Albright’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.