function outline_designer_settings in Outline Designer 5
Same name and namespace in other branches
- 6.2 outline_designer.module \outline_designer_settings()
- 7.2 outline_designer.module \outline_designer_settings()
Implementation of hook_settings
1 string reference to 'outline_designer_settings'
- outline_designer_menu in ./
outline_designer.module - Implementation of hook_menu
File
- ./
outline_designer.module, line 99
Code
function outline_designer_settings() {
//build out a list of the packaged icons
$packaged_icons = 'Outline Designer Icons: ';
$icons = array(
'add',
'edit',
'delete',
'duplicate',
'rename',
'node',
'page',
'folder',
);
foreach ($icons as $title) {
$packaged_icons .= '<img src="' . base_path() . drupal_get_path('module', 'outline_designer') . '/images/' . $title . '.png" title="' . $title . '" alt="' . $title . '" hspace="2px" />';
}
$packaged_icons .= ' <br />Uploaded Icons: ';
//create it juuuust incase and make sure it's writable
$dir = file_create_path(file_directory_path() . '/outline_designer');
file_check_directory($dir, 1);
if ($handle = opendir('./' . file_directory_path() . '/outline_designer')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$packaged_icons .= '<img src="' . base_path() . file_directory_path() . '/outline_designer/' . $file . '" title="' . $file . '" alt="' . $file . '" hspace="2px" />';
}
}
closedir($handle);
}
//hidden space to throw out the icons before the rest of the content
$form["outline_designer_hidden"] = array(
'#type' => 'hidden',
'#title' => 'Available icons',
'#suffix' => $packaged_icons,
);
$content_types = array();
$result = db_query("SELECT type,name FROM {node_type}");
while ($value = db_fetch_array($result)) {
array_push($content_types, t($value['type']));
//create a textfield incase they want to enter an icon that way
$form["outline_designer_" . $value['type'] . "_icon_link"] = array(
'#type' => 'textfield',
'#title' => t("Link to " . $value['name'] . " Icon"),
'#default_value' => variable_get("outline_designer_" . $value['type'] . "_icon", drupal_get_path('module', 'outline_designer') . "/images/node.png"),
'#description' => '<img src="' . base_path() . variable_get("outline_designer_" . $value['type'] . "_icon", drupal_get_path('module', 'outline_designer') . "/images/node.png") . '" /> ' . t("You can drag the icons from above onto this field to get the full path or add a path of your own."),
'#required' => false,
);
//Create a upload field for each content type so icons can be added for them
$form["outline_designer_" . $value['type'] . "_icon"] = array(
'#type' => 'file',
'#size' => '10',
'#title' => t("Icon for " . $value['name']),
'#default_value' => variable_get("outline_designer_" . $value['type'] . "_icon", drupal_get_path('module', 'outline_designer') . "/images/node.png"),
'#description' => t("This is what icon will be associated to each content type in the outline designer. They must be 16x16 gif or png format."),
'#required' => false,
);
}
$form["outline_designer_default_type"] = array(
'#type' => 'select',
'#title' => t("Default Content Type"),
'#default_value' => variable_get("outline_designer_default_type", "page"),
'#options' => drupal_map_assoc($content_types),
'#description' => t("This is what content type will be used when creating a new outline as well as the default if a user has the ability to create content but not change types."),
'#required' => true,
'#multiple' => false,
);
$form["outline_designer_content_types"] = array(
'#type' => 'select',
'#title' => t("Valid Content Types"),
'#default_value' => variable_get("outline_designer_content_types", ""),
'#options' => drupal_map_assoc($content_types),
'#description' => t("This defines which content types are accessible by this method of content creation"),
'#required' => true,
'#multiple' => true,
);
$form['#attributes'] = array(
'enctype' => "multipart/form-data",
);
return system_settings_form($form);
}