delta_injection_color.inc in Delta 7.3
File
delta_color/plugins/delta_injection_color.inc
View source
<?php
class delta_injection_color extends delta_injection {
function variables() {
return array(
'color_' . $this->delta->theme . '_files',
'color_' . $this->delta->theme . '_logo',
'color_' . $this->delta->theme . '_palette',
'color_' . $this->delta->theme . '_stylesheets',
'color_' . $this->delta->theme . '_screenshot',
);
}
function form_alter(&$form, &$form_state) {
color_form_system_theme_settings_alter($form, $form_state);
}
function form_validate($form, &$form_state) {
parent::form_validate($form, $form_state);
$files = $this
->backup('color_' . $this->delta->theme . '_files');
if (!empty($files) && ($directory = dirname(reset($files)))) {
@rename($directory, $directory . '-delta');
}
}
function form_submit($form, &$form_state) {
if (!empty($this->delta->settings['color_' . $this->delta->theme . '_files'])) {
foreach ($this->delta->settings['color_' . $this->delta->theme . '_files'] as $file) {
@drupal_unlink($file);
}
if (isset($file) && ($file = dirname($file))) {
@drupal_rmdir($file);
}
}
parent::form_submit($form, $form_state);
$files = $this
->backup('color_' . $this->delta->theme . '_files');
if (!empty($files) && ($directory = dirname(reset($files)))) {
@rename($directory . '-delta', $directory);
}
}
}