Created
March 15, 2012 11:16
-
-
Save vincenzo/2043713 to your computer and use it in GitHub Desktop.
Programmatic CCK Content Type Updated - Step 6 - part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_requirements() | |
*/ | |
function example_cck_content_requirements($phase) { | |
$requirements = array(); | |
$t = get_t(); | |
// an array of the dependencies | |
// where the array key is the module machine-readable name | |
// and the value is the module human-readable name | |
$dependencies = array( | |
'content' => 'Content', | |
'filefield' => 'FileField', | |
'imagefield' => 'ImageField', | |
'text' => 'Text', | |
); | |
switch ($phase) { | |
case 'install': | |
$error = FALSE; | |
$value = ''; | |
foreach ($dependencies as $dependency => $module_nice_name) { | |
if (!module_exists($dependency)) { | |
$error = TRUE; | |
$value .= $t($module_nice_name . " to be pre - installed; "); | |
$severity = REQUIREMENT_ERROR; | |
} | |
} | |
if ($error) { | |
$requirements['example_cck_content'] = array( | |
'title' => $t('Example CCK Content requires: '), | |
'value' => $value . $t(' if the required modules are now installed, please enable this module again.'), | |
'severity' => $severity, | |
); | |
} | |
break; | |
} | |
return $requirements; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment