id stringlengths 22 22 | drupal_version stringclasses 1
value | source_type stringclasses 1
value | source_url stringlengths 70 167 | instruction stringlengths 87 500 | context stringlengths 16 10.7k | response stringlengths 68 5.97k | tags listlengths 2 2 | created_at timestamp[s]date 2026-09-30 00:00:00 2026-09-30 00:00:00 |
|---|---|---|---|---|---|---|---|---|
api-drupal7-310557bb0c | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21comment%21comment.module/function/comment_access/7.x | In Drupal 7, write the function `comment_access($op, $comment)` (file modules/comment/comment.module) so that it does the following: Determines whether the current user has access to a particular comment. | Authenticated users can edit their comments as long they have not been replied to. This prevents people from changing or revising their statements based on the replies to their posts.
Parameters:
- $op: The operation that is to be performed on the comment. Only 'edit' is recognized now.
- $comment: The comment object.... | function comment_access($op, $comment) {
global $user;
if ($op == 'edit') {
return ($user->uid && $user->uid == $comment->uid && $comment->status == COMMENT_PUBLISHED && user_access('edit own comments')) || user_access('administer comments');
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3139084f02 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.admin.inc/function/user_admin_permissions/7.x | I need the code for `user_admin_permissions($form, $form_state, $rid = NULL)` in Drupal 7 (modules/user/user.admin.inc). It must do this: Menu callback: administer permissions. | File: modules/user/user.admin.inc | function user_admin_permissions($form, $form_state, $rid = NULL) {
// Retrieve role names for columns.
$role_names = user_roles();
if (is_numeric($rid)) {
$role_names = array($rid => $role_names[$rid]);
}
// Fetch permissions for all roles or the one selected role.
$role_permissions = user_role_permiss... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-31785da65f | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21overlay%21overlay.module/function/overlay_deliver_empty_page/7.x | Implement `overlay_deliver_empty_page()` in PHP for Drupal 7. Required behavior: Prints an empty page. | This function is used to print out a bare minimum empty page which still has the scripts and styles necessary in order to trigger the overlay to close.
File: modules/overlay/overlay.module | function overlay_deliver_empty_page() {
$empty_page = '<html><head><title></title>' . drupal_get_css() . drupal_get_js() . '</head><body class="overlay"></body></html>';
print $empty_page;
drupal_exit();
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-31a716d905 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21contextual%21contextual.module/function/contextual_preprocess/7.x | I need the code for `contextual_preprocess(&$variables, $hook)` in Drupal 7 (modules/contextual/contextual.module). It must do this: Implements hook_preprocess(). | File: modules/contextual/contextual.module | function contextual_preprocess(&$variables, $hook) {
// Nothing to do here if the user is not permitted to access contextual links.
if (!user_access('access contextual links')) {
return;
}
$hooks = theme_get_registry(FALSE);
// Determine the primary theme function argument.
if (!empty($hooks[$hook]['v... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-31c1f6ff1a | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21update.inc/function/update_do_one/7.x | Implement `update_do_one($module, $number, $dependency_map, &$context)` in PHP for Drupal 7. Required behavior: Implements callback_batch_operation(). | Performs one update and stores the results for display on the results page.
If an update function completes successfully, it should return a message as a string indicating success, for example:
Parameters:
- $module: The module whose update will be run.
- $number: The update number to run.
- $dependency_map: An array... | function update_do_one($module, $number, $dependency_map, &$context) {
$function = $module . '_update_' . $number;
// If this update was aborted in a previous step, or has a dependency that
// was aborted in a previous step, go no further.
if (!empty($context['results']['#abort']) && array_intersect($context['... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-321ecd24b0 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21simpletest%21simpletest.install/function/simpletest_requirements/7.x | Implement `simpletest_requirements($phase)` in PHP for Drupal 7. Required behavior: Implements hook_requirements(). | File: modules/simpletest/simpletest.install | function simpletest_requirements($phase) {
$requirements = array();
$t = get_t();
$has_curl = function_exists('curl_init');
$has_hash = function_exists('hash_hmac');
$has_domdocument = method_exists('DOMDocument', 'loadHTML');
$requirements['curl'] = array(
'title' => $t('cURL'),
'value' => $has_c... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-32414bcb25 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_account_form_validate/7.x | Implement `user_account_form_validate($form, &$form_state)` in PHP for Drupal 7. Required behavior: Form validation handler for user_account_form(). | File: modules/user/user.module | function user_account_form_validate($form, &$form_state) {
if ($form['#user_category'] == 'account' || $form['#user_category'] == 'register') {
$account = $form['#user'];
// Validate new or changing username.
if (isset($form_state['values']['name'])) {
if ($error = user_validate_name($form_state['va... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-324adf20d9 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_get_breadcrumb/7.x | I need the code for `drupal_get_breadcrumb()` in Drupal 7 (includes/common.inc). It must do this: Gets the breadcrumb trail for the current page. | File: includes/common.inc | function drupal_get_breadcrumb() {
$breadcrumb = drupal_set_breadcrumb();
if (!isset($breadcrumb)) {
$breadcrumb = menu_get_active_breadcrumb();
}
return $breadcrumb;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-324c2fcf26 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.api.php/function/hook_field_storage_delete/7.x | In Drupal 7, show an example implementation for `hook_field_storage_delete($entity_type, $entity, $fields)` (modules/field/field.api.php): Delete all field data for an entity. | This hook is invoked from field_attach_delete() to ask the field storage module to delete field data.
Parameters:
- $entity_type: The entity type of entity, such as 'node' or 'user'.
- $entity: The entity on which to operate.
- $fields: An array listing the fields to delete. The keys and values of the array are field ... | function hook_field_storage_delete($entity_type, $entity, $fields) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
foreach (field_info_instances($entity_type, $bundle) as $instance) {
if (isset($fields[$instance['field_id']])) {
$field = field_info_field_by_id($instance['field_id'... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-3251608986 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.admin.inc/function/system_performance_settings/7.x | Implement `system_performance_settings()` in PHP for Drupal 7. Required behavior: Form builder; Configure site performance settings. | File: modules/system/system.admin.inc | function system_performance_settings() {
drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
$form['clear_cache'] = array(
'#type' => 'fieldset',
'#title' => t('Clear cache'),
);
$form['clear_cache']['clear'] = array(
'#type' => 'submit',
'#value' => t('Clear all caches'),
'... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3257dcb54e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_install/7.x | I need the code for `system_install()` in Drupal 7 (modules/system/system.install). It must do this: Implements hook_install(). | File: modules/system/system.install | function system_install() {
// Create tables.
drupal_install_schema('system');
$versions = drupal_get_schema_versions('system');
$version = $versions ? max($versions) : SCHEMA_INSTALLED;
drupal_set_installed_schema_version('system', $version);
// Clear out module list and hook implementation statics before... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-325b1dfbe4 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21translation%21translation.module/function/translation_help/7.x | I need the code for `translation_help($path, $arg)` in Drupal 7 (modules/translation/translation.module). It must do this: Implements hook_help(). | File: modules/translation/translation.module | function translation_help($path, $arg) {
switch ($path) {
case 'admin/help#translation':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Content translation module allows content to be translated into different languages. Working with the <a href="@locale">Local... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-327f4fdc71 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21image%21image.admin.inc/function/theme_image_style_list/7.x | Implement `theme_image_style_list($variables)` in PHP for Drupal 7. Required behavior: Returns HTML for the page containing the list of image styles. | Parameters:
- $variables: An associative array containing: - styles: An array of all the image styles returned by image_get_styles().
File: modules/image/image.admin.inc | function theme_image_style_list($variables) {
$styles = $variables['styles'];
$header = array(t('Style name'), t('Settings'), array('data' => t('Operations'), 'colspan' => 3));
$rows = array();
foreach ($styles as $style) {
$row = array();
$row[] = l($style['label'], 'admin/config/media/image-styles/ed... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-329f200edf | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21common.inc/function/xmlrpc/7.x | In Drupal 7, write the function `xmlrpc($url, $args, $options = array())` (file includes/common.inc) so that it does the following: Performs one or more XML-RPC request(s). | Usage example:
Parameters:
- $url: An absolute URL of the XML-RPC endpoint.
- $args: An associative array whose keys are the methods to call and whose values are the arguments to pass to the respective method. If multiple methods are specified, a system.multicall is performed.
- $options: (optional) An array of option... | function xmlrpc($url, $args, $options = array()) {
require_once DRUPAL_ROOT . '/includes/xmlrpc.inc';
return _xmlrpc($url, $args, $options);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32b22fb611 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21overlay%21overlay.module/function/overlay_display_empty_page/7.x | Implement `overlay_display_empty_page($value = NULL)` in PHP for Drupal 7. Required behavior: Stores and returns whether an empty page override is needed. | This is used to prevent a page request which closes the overlay (for example, a form submission) from being fully re-rendered before the overlay is closed. Instead, we store a variable which will cause the page to be rendered by a delivery callback function that does not actually print visible HTML (but rather only the... | function overlay_display_empty_page($value = NULL) {
$display_empty_page = &drupal_static(__FUNCTION__, FALSE);
if (isset($value)) {
$display_empty_page = $value;
}
return $display_empty_page;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32b25e4f52 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21image%21image.admin.inc/function/image_effect_delete_form_submit/7.x | I need the code for `image_effect_delete_form_submit($form, &$form_state)` in Drupal 7 (modules/image/image.admin.inc). It must do this: Submit handler to delete an image effect. | File: modules/image/image.admin.inc | function image_effect_delete_form_submit($form, &$form_state) {
$style = $form_state['image_style'];
$effect = $form_state['image_effect'];
image_effect_delete($effect);
drupal_set_message(t('The image effect %name has been deleted.', array('%name' => $effect['label'])));
$form_state['redirect'] = 'admin/con... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32c7dc1b6d | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.admin.inc/function/theme_taxonomy_overview_terms/7.x | Implement `theme_taxonomy_overview_terms($variables)` in PHP for Drupal 7. Required behavior: Returns HTML for a terms overview form as a sortable list of terms. | Parameters:
- $variables: An associative array containing: - form: A render element representing the form.
File: modules/taxonomy/taxonomy.admin.inc | function theme_taxonomy_overview_terms($variables) {
$form = $variables['form'];
$page_increment = $form['#page_increment'];
$page_entries = $form['#page_entries'];
$back_step = $form['#back_step'];
$forward_step = $form['#forward_step'];
// Add drag and drop if parent fields are present in the f... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32cf682ffc | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_update_7029/7.x | In Drupal 7, write the function `system_update_7029()` (file modules/system/system.install) so that it does the following: Add new 'view own unpublished content' permission for authenticated users. Preserves legacy behavior from Drupal 6.x. | File: modules/system/system.install | function system_update_7029() {
db_insert('role_permission')
->fields(array(
'rid' => DRUPAL_AUTHENTICATED_RID,
'permission' => 'view own unpublished content',
))
->execute();
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32d61c4c27 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21node%21node.install/function/node_update_7016/7.x | In Drupal 7, write the function `node_update_7016()` (file modules/node/node.install) so that it does the following: Change {history}.nid to an unsigned int in order to match {node}.nid. | File: modules/node/node.install | function node_update_7016() {
db_drop_primary_key('history');
db_drop_index('history', 'nid');
db_change_field('history', 'nid', 'nid', array(
'description' => 'The {node}.nid that was read.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_add_primary_key('... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32f08f4134 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.admin.inc/function/theme_user_admin_permissions/7.x | In Drupal 7, write the function `theme_user_admin_permissions($variables)` (file modules/user/user.admin.inc) so that it does the following: Returns HTML for the administer permissions page. | Parameters:
- $variables: An associative array containing: - form: A render element representing the form.
File: modules/user/user.admin.inc | function theme_user_admin_permissions($variables) {
$form = $variables['form'];
$roles = user_roles();
foreach (element_children($form['permission']) as $key) {
$row = array();
// Module name
if (is_numeric($key)) {
$row[] = array('data' => drupal_render($form['permission'][$key]), 'class' => a... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32f563ede5 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21color%21color.module/function/_color_render_images/7.x | Implement `_color_render_images($theme, &$info, &$paths, $palette)` in PHP for Drupal 7. Required behavior: Renders images that match a given palette. | File: modules/color/color.module | function _color_render_images($theme, &$info, &$paths, $palette) {
// Prepare template image.
$source = $paths['source'] . '/' . $info['base_image'];
$source = imagecreatefrompng($source);
$width = imagesx($source);
$height = imagesy($source);
// Prepare target buffer.
$target = imagecreatetruecolor($wid... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-32fbce0d90 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_update_7033/7.x | Implement `system_update_7033()` in PHP for Drupal 7. Required behavior: Move CACHE_AGGRESSIVE to CACHE_NORMAL. | File: modules/system/system.install | function system_update_7033() {
if (variable_get('cache') == 2) {
variable_set('cache', 1);
return t('Aggressive caching was disabled and replaced with normal caching. Read the page caching section in default.settings.php for more information on how to enable similar functionality.');
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3334fff1d5 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/function/taxonomy_term_uri/7.x | I need the code for `taxonomy_term_uri($term)` in Drupal 7 (modules/taxonomy/taxonomy.module). It must do this: Implements callback_entity_info_uri(). | File: modules/taxonomy/taxonomy.module | function taxonomy_term_uri($term) {
return array(
'path' => 'taxonomy/term/' . $term->tid,
);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3340c458da | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_update_7046/7.x | In Drupal 7, write the function `system_update_7046()` (file modules/system/system.install) so that it does the following: Switch from the Minnelli theme if it is the default or admin theme. | File: modules/system/system.install | function system_update_7046() {
if (variable_get('theme_default') == 'minnelli' || variable_get('admin_theme') == 'minnelli') {
// Make sure Garland is enabled.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'garland')
->execute();
... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-33582f6060 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21aggregator%21aggregator.pages.inc/function/template_preprocess_aggregator_summary_item/7.x | Implement `template_preprocess_aggregator_summary_item(&$variables)` in PHP for Drupal 7. Required behavior: Processes variables for aggregator-summary-item.tpl.php. | File: modules/aggregator/aggregator.pages.inc | function template_preprocess_aggregator_summary_item(&$variables) {
$item = $variables['item'];
$variables['feed_url'] = check_url($item->link);
$variables['feed_title'] = check_plain($item->title);
$variables['feed_age'] = t('%age old', array('%age' => format_interval(REQUEST_TIME - $item->timestamp)));
$v... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-33763d302e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21shortcut%21shortcut.module/function/shortcut_set_get_unique_name/7.x | Implement `shortcut_set_get_unique_name()` in PHP for Drupal 7. Required behavior: Returns a unique, machine-readable shortcut set name. | File: modules/shortcut/shortcut.module | function shortcut_set_get_unique_name() {
// Shortcut sets are numbered sequentially, so we keep trying until we find
// one that is available. For better performance, we start with a number
// equal to one more than the current number of shortcut sets, so that if
// no shortcut sets have been deleted from the ... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-337ca98488 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21filter%21filter.module/function/filter_default_format/7.x | Implement `filter_default_format($account = NULL)` in PHP for Drupal 7. Required behavior: Returns the ID of the default text format for a particular user. | The default text format is the first available format that the user is allowed to access, when the formats are ordered by weight. It should generally be used as a default choice when presenting the user with a list of possible text formats (for example, in a node creation form).
Conversely, when existing content that ... | function filter_default_format($account = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
// Get a list of formats for this user, ordered by weight. The first one
// available is the user's default format.
$formats = filter_formats($account);
$format = reset($formats);
return $form... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-337d6275df | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21image%21image.admin.inc/function/image_style_form_add_validate/7.x | I need the code for `image_style_form_add_validate($form, &$form_state)` in Drupal 7 (modules/image/image.admin.inc). It must do this: Validate handler for adding a new image effect to an image style. | File: modules/image/image.admin.inc | function image_style_form_add_validate($form, &$form_state) {
if (!$form_state['values']['new']) {
form_error($form['effects']['new']['new'], t('Select an effect to add.'));
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-33aded1ed5 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_check_incompatibility/7.x | Implement `drupal_check_incompatibility($v, $current_version)` in PHP for Drupal 7. Required behavior: Checks whether a version is compatible with a given dependency. | Parameters:
- $v: The parsed dependency structure from drupal_parse_dependency().
- $current_version: The version to check against (like 4.2).
Returns (NULL): if compatible, otherwise the original dependency version string that caused the incompatibility.
File: includes/common.inc | function drupal_check_incompatibility($v, $current_version) {
if (!empty($v['versions'])) {
foreach ($v['versions'] as $required_version) {
if ((isset($required_version['op']) && !version_compare($current_version, $required_version['version'], $required_version['op']))) {
return $v['original_version... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-33db6d6ce7 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21node%21node.pages.inc/function/node_page_edit/7.x | Implement `node_page_edit($node)` in PHP for Drupal 7. Required behavior: Menu callback; presents the node editing form. | File: modules/node/node.pages.inc | function node_page_edit($node) {
$type_name = node_type_get_name($node);
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH);
return drupal_get_form($node->type . '_node_form', $node);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-33e0691241 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.api.php/function/hook_field_delete_revision/7.x | Give me the example code for `hook_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items)` in Drupal 7. Hook description: Define custom revision delete behavior for this module's field types. | This hook is invoked just before the data is deleted from field storage in field_attach_delete_revision(), and will only be called for fieldable types that are versioned.
Parameters:
- $entity_type: The type of $entity.
- $entity: The entity for the operation.
- $field: The field structure for the operation.
- $instan... | function hook_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
foreach ($items as $delta => $item) {
// For hook_file_references, remember that this file is being deleted.
$item['file_field_name'] = $f... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-340adb69a1 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21statistics%21statistics.admin.inc/function/statistics_settings_form/7.x | Implement `statistics_settings_form()` in PHP for Drupal 7. Required behavior: Form constructor for the statistics administration form. | File: modules/statistics/statistics.admin.inc | function statistics_settings_form() {
// Access log settings.
$form['access'] = array(
'#type' => 'fieldset',
'#title' => t('Access log settings'),
);
$form['access']['statistics_enable_access_log'] = array(
'#type' => 'checkbox',
'#title' => t('Enable access log'),
'#default_value' => varia... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3428a7ba8e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21language.inc/function/language_types_disable/7.x | Implement `language_types_disable($types)` in PHP for Drupal 7. Required behavior: Disables the given language types. | Parameters:
- $types: An array of language types.
File: includes/language.inc | function language_types_disable($types) {
$enabled_types = variable_get('language_types', drupal_language_types());
foreach ($types as $type) {
unset($enabled_types[$type]);
}
variable_set('language_types', $enabled_types);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-343090b6b0 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21color%21color.module/function/_color_html_alter/7.x | In Drupal 7, write the function `_color_html_alter(&$vars)` (file modules/color/color.module) so that it does the following: Replaces style sheets with color-altered style sheets. | A theme that supports the color module should call this function from its THEME_process_html() function, so that the correct style sheets are included when html.tpl.php is rendered.
File: modules/color/color.module | function _color_html_alter(&$vars) {
global $theme_key;
$themes = list_themes();
// Override stylesheets.
$color_paths = variable_get('color_' . $theme_key . '_stylesheets', array());
if (!empty($color_paths)) {
foreach ($themes[$theme_key]->stylesheets['all'] as $base_filename => $old_path) {
// ... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-34418306f4 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.api.php/function/hook_field_storage_details_alter/7.x | Give me the example code for `hook_field_storage_details_alter(&$details, $field)` in Drupal 7. Hook description: Perform alterations on Field API storage details. | Parameters:
- $details: An array of storage details for fields as exposed by hook_field_storage_details() implementations.
- $field: A field structure.
File: modules/field/field.api.php | function hook_field_storage_details_alter(&$details, $field) {
if ($field['field_name'] == 'field_of_interest') {
$columns = array();
foreach ((array) $field['columns'] as $column_name => $attributes) {
$columns[$column_name] = $column_name;
}
$details['drupal_variables'] = array(
FIELD_LO... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-34584a6570 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_update_7074/7.x | In Drupal 7, write the function `system_update_7074()` (file modules/system/system.install) so that it does the following: This update has been removed and will not run. | File: modules/system/system.install | function system_update_7074() {
// This update function previously converted menu_links query strings to
// arrays. It has been removed for now due to incompatibility with
// PostgreSQL.
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-345864543e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21dashboard%21dashboard.module/function/dashboard_region_descriptions/7.x | Implement `dashboard_region_descriptions()` in PHP for Drupal 7. Required behavior: Returns an array of dashboard region descriptions, keyed by region name. | File: modules/dashboard/dashboard.module | function dashboard_region_descriptions() {
$regions = module_invoke_all('dashboard_regions');
drupal_alter('dashboard_regions', $regions);
return $regions;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-345ca3e43d | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_status/7.x | In Drupal 7, show an example implementation for `hook_search_status()` (modules/search/search.api.php): Report the status of indexing. | The core search module only invokes this hook on active modules. Implementing modules do not need to check whether they are active when calculating their return values.
Returns: An associative array with the key-value pairs: - 'remaining': The number of items left to index. - 'total': The total number of items to inde... | function hook_search_status() {
$total = db_query('SELECT COUNT(*) FROM {node} WHERE status = 1')->fetchField();
$remaining = db_query("SELECT COUNT(*) FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE n.status = 1 AND d.sid IS NULL OR d.reindex <> 0")->fetchField();
return arr... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-34729659cd | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_user_categories/7.x | Implement `user_user_categories()` in PHP for Drupal 7. Required behavior: Implements hook_user_categories(). | File: modules/user/user.module | function user_user_categories() {
return array(array(
'name' => 'account',
'title' => t('Account settings'),
'weight' => 1,
));
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-347ecb19bc | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21block%21block.admin.inc/function/block_admin_display_prepare_blocks/7.x | In Drupal 7, write the function `block_admin_display_prepare_blocks($theme)` (file modules/block/block.admin.inc) so that it does the following: Prepares a list of blocks for display on the blocks administration page. | Parameters:
- $theme: The machine-readable name of the theme whose blocks should be returned.
Returns: An array of blocks, as returned by _block_rehash(), sorted by region in preparation for display on the blocks administration page.
File: modules/block/block.admin.inc | function block_admin_display_prepare_blocks($theme) {
$blocks = _block_rehash($theme);
$compare_theme = &drupal_static('_block_compare:theme');
$compare_theme = $theme;
usort($blocks, '_block_compare');
return $blocks;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3480a6fd91 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21block%21block.admin.inc/function/block_add_block_form_validate/7.x | I need the code for `block_add_block_form_validate($form, &$form_state)` in Drupal 7 (modules/block/block.admin.inc). It must do this: Form validation handler for block_add_block_form(). | File: modules/block/block.admin.inc | function block_add_block_form_validate($form, &$form_state) {
$custom_block_exists = (bool) db_query_range('SELECT 1 FROM {block_custom} WHERE info = :info', 0, 1, array(':info' => $form_state['values']['info']))->fetchField();
if (empty($form_state['values']['info']) || $custom_block_exists) {
form_set_error(... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3490914f35 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.install/function/_update_7000_field_create_instance/7.x | I need the code for `_update_7000_field_create_instance($field, &$instance)` in Drupal 7 (modules/field/field.install). It must do this: Utility function: write a field instance directly to the database. | This function can be used for databases whose schema is at field module version 7000 or higher.
File: modules/field/field.install | function _update_7000_field_create_instance($field, &$instance) {
// Merge in defaults.
$instance += array(
'field_id' => $field['id'],
'field_name' => $field['field_name'],
'deleted' => 0,
);
// The serialized 'data' column contains everything from $instance that does
// not have its own column ... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-34b016a6f9 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21xmlrpc.inc/function/xmlrpc_message_set/7.x | Implement `xmlrpc_message_set($value = NULL)` in PHP for Drupal 7. Required behavior: Stores a copy of the most recent XML-RPC message object temporarily. | Parameters:
- $value: An XML-RPC message to store, or NULL to keep the last message.
Returns (object): The most recently stored message.
File: includes/xmlrpc.inc | function xmlrpc_message_set($value = NULL) {
static $xmlrpc_message;
if ($value) {
$xmlrpc_message = $value;
}
return $xmlrpc_message;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-34b4e28368 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21filter%21filter.module/function/theme_text_format_wrapper/7.x | I need the code for `theme_text_format_wrapper($variables)` in Drupal 7 (modules/filter/filter.module). It must do this: Returns HTML for a text format-enabled form element. | Parameters:
- $variables: An associative array containing: - element: A render element containing #children and #description.
File: modules/filter/filter.module | function theme_text_format_wrapper($variables) {
$element = $variables['element'];
$output = '<div class="text-format-wrapper">';
$output .= $element['#children'];
if (!empty($element['#description'])) {
$output .= '<div class="description">' . $element['#description'] . '</div>';
}
$output .= "</div>\n... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-34baca6de6 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21image%21image.field.inc/function/theme_image_formatter/7.x | In Drupal 7, write the function `theme_image_formatter($variables)` (file modules/image/image.field.inc) so that it does the following: Returns HTML for an image field formatter. | Parameters:
- $variables: An associative array containing: - item: Associative array of image data, which may include "uri", "alt", "width", "height", "title" and "attributes". - image_style: An optional image style. - path: An array containing the link 'path' and link 'options'.
File: modules/image/image.field.inc | function theme_image_formatter($variables) {
$item = $variables['item'];
$image = array(
'path' => $item['uri'],
);
if (array_key_exists('alt', $item)) {
$image['alt'] = $item['alt'];
}
if (isset($item['attributes'])) {
$image['attributes'] = $item['attributes'];
}
if (isset($item['width'... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-34bbe5f3b0 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access/7.x | In Drupal 7, show an example implementation for `hook_node_access($node, $op, $account)` (modules/node/node.api.php): Control access to a node. | Modules may implement this hook if they want to have a say in whether or not a given user has access to perform a given operation on a node.
The administrative account (user ID #1) always passes any access check, so this hook is not called in that case. Users with the "bypass node access" permission may always view an... | function hook_node_access($node, $op, $account) {
$type = is_string($node) ? $node : $node->type;
if (in_array($type, node_permissions_get_configured_types())) {
if ($op == 'create' && user_access('create ' . $type . ' content', $account)) {
return NODE_ACCESS_ALLOW;
}
if ($op == 'update') {
... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-34c75669e2 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21profile%21profile.module/function/profile_user_presave/7.x | In Drupal 7, write the function `profile_user_presave(&$edit, $account, $category)` (file modules/profile/profile.module) so that it does the following: Implements hook_user_presave(). | File: modules/profile/profile.module | function profile_user_presave(&$edit, $account, $category) {
if (!empty($account->uid)) {
profile_save_profile($edit, $account, $category);
}
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-34dd370419 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21path%21path.api.php/function/hook_path_delete/7.x | Give me the example code for `hook_path_delete($path)` in Drupal 7. Hook description: Respond to a path being deleted. | Parameters:
- $path: An associative array containing the following keys: - source: The internal system path. - alias: The URL alias. - pid: Unique path alias identifier. - language: The language of the alias.
File: modules/path/path.api.php | function hook_path_delete($path) {
db_delete('mytable')
->condition('pid', $path['pid'])
->execute();
} | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-34e33e7d77 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_preferred_language/7.x | In Drupal 7, write the function `user_preferred_language($account, $default = NULL)` (file modules/user/user.module) so that it does the following: Get the language object preferred by the user. This user preference can be set on the user account editing page, and is only available if there are more than one languages ... | Parameters:
- $account: User account to look up language for.
- $default: Optional default language object to return if the account has no valid language.
File: modules/user/user.module | function user_preferred_language($account, $default = NULL) {
$language_list = language_list();
if (!empty($account->language) && isset($language_list[$account->language])) {
return $language_list[$account->language];
}
else {
return $default ? $default : language_default();
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3506cc797d | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.crud.inc/function/field_read_instances/7.x | I need the code for `field_read_instances($params = array(), $include_additional = array())` in Drupal 7 (modules/field/field.crud.inc). It must do this: Reads in field instances that match an array of conditions. | Parameters:
- $param: An array of properties to use in selecting a field instance. Valid keys include any column of the field_config_instance table. If NULL, all instances will be returned.
- $include_additional: The default behavior of this function is to not return field instances that have been marked deleted, or wh... | function field_read_instances($params = array(), $include_additional = array()) {
$include_inactive = isset($include_additional['include_inactive']) && $include_additional['include_inactive'];
$include_deleted = isset($include_additional['include_deleted']) && $include_additional['include_deleted'];
$query = db_... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35132ff979 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21file%21file.module/function/file_managed_file_value/7.x | Implement `file_managed_file_value(&$element, $input = FALSE, $form_state = NULL)` in PHP for Drupal 7. Required behavior: The #value_callback for a managed_file type element. | File: modules/file/file.module | function file_managed_file_value(&$element, $input = FALSE, $form_state = NULL) {
$fid = 0;
$force_default = FALSE;
// Find the current value of this field from the form state.
$form_state_fid = $form_state['values'];
foreach ($element['#parents'] as $parent) {
$form_state_fid = isset($form_state_fid[$pa... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3516897809 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21announcements_feed%21announcements_feed.module/function/_announcements_feed_preprocess_item/7.x | In Drupal 7, write the function `_announcements_feed_preprocess_item(&$item)` (file modules/announcements_feed/announcements_feed.module) so that it does the following: Helper to preprocess individual announcement items. | File: modules/announcements_feed/announcements_feed.module | function _announcements_feed_preprocess_item(&$item) {
$item['title'] = filter_xss($item['title']);
$item['teaser'] = filter_xss($item['teaser']);
$item['link'] = check_url($item['link']);
$item['date_modified'] = check_plain($item['date_modified']);
$item['date_published'] = check_plain($item['date_published... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3519f59c99 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21forum%21forum.module/function/_forum_get_topic_order/7.x | I need the code for `_forum_get_topic_order($sortby)` in Drupal 7 (modules/forum/forum.module). It must do this: Gets topic sorting information based on an integer code. | Parameters:
- $sortby: One of the following integers indicating the sort criteria: - 1: Date - newest first. - 2: Date - oldest first. - 3: Posts with the most comments first. - 4: Posts with the least comments first.
Returns: An array with the following values: - field: A field for an SQL query. - sort: 'asc' or 'des... | function _forum_get_topic_order($sortby) {
switch ($sortby) {
case 1:
return array('field' => 'f.last_comment_timestamp', 'sort' => 'desc');
break;
case 2:
return array('field' => 'f.last_comment_timestamp', 'sort' => 'asc');
break;
case 3:
return array('field' => 'f.comment_... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35293f9c8e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.module/function/system_stream_wrappers/7.x | Implement `system_stream_wrappers()` in PHP for Drupal 7. Required behavior: Implements hook_stream_wrappers(). | File: modules/system/system.module | function system_stream_wrappers() {
$wrappers = array(
'public' => array(
'name' => t('Public files'),
'class' => 'DrupalPublicStreamWrapper',
'description' => t('Public local files served by the webserver.'),
'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
),
'temporary' => array(
'... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-352bdd4287 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7007/7.x | I need the code for `user_update_7007()` in Drupal 7 (modules/user/user.install). It must do this: Add a weight column to user roles. | File: modules/user/user.install | function user_update_7007() {
db_add_field('role', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
db_add_index('role', 'name_weight', array('name', 'weight'));
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35329c0141 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21forum%21forum.module/function/forum_node_info/7.x | In Drupal 7, write the function `forum_node_info()` (file modules/forum/forum.module) so that it does the following: Implements hook_node_info(). | File: modules/forum/forum.module | function forum_node_info() {
return array(
'forum' => array(
'name' => t('Forum topic'),
'base' => 'forum',
'description' => t('A <em>forum topic</em> starts a new discussion thread within a forum.'),
'title_label' => t('Subject'),
)
);
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-3535817057 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21poll%21poll.install/function/poll_update_7002/7.x | In Drupal 7, write the function `poll_update_7002()` (file modules/poll/poll.install) so that it does the following: Add timestamp field to {poll_vote}. | File: modules/poll/poll.install | function poll_update_7002() {
$field = array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
);
db_add_field('poll_vote', 'timestamp', $field);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35359cb317 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21profile%21profile.admin.inc/function/profile_admin_overview/7.x | Implement `profile_admin_overview($form)` in PHP for Drupal 7. Required behavior: Form builder to display a listing of all editable profile fields. | File: modules/profile/profile.admin.inc | function profile_admin_overview($form) {
$result = db_query('SELECT title, name, type, category, fid, weight FROM {profile_field} ORDER BY category, weight');
$categories = array();
foreach ($result as $field) {
// Collect all category information
$categories[] = $field->category;
// Save all field ... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3542be6d6f | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21node%21node.module/function/node_modules_enabled/7.x | In Drupal 7, write the function `node_modules_enabled($modules)` (file modules/node/node.module) so that it does the following: Implements hook_modules_enabled(). | File: modules/node/node.module | function node_modules_enabled($modules) {
// Check if any of the newly enabled modules require the node_access table to
// be rebuilt.
if (!node_access_needs_rebuild() && array_intersect($modules, module_implements('node_grants'))) {
node_access_needs_rebuild(TRUE);
}
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-35482b8fc8 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21common.inc/function/archiver_get_archiver/7.x | I need the code for `archiver_get_archiver($file)` in Drupal 7 (includes/common.inc). It must do this: Creates the appropriate archiver for the specified file. | Parameters:
- $file: The full path of the archive file. Note that stream wrapper paths are supported, but not remote ones.
Returns: A newly created instance of the archiver class appropriate for the specified file, already bound to that file. If no appropriate archiver class was found, will return FALSE.
File: includ... | function archiver_get_archiver($file) {
// Archivers can only work on local paths
$filepath = drupal_realpath($file);
if (!is_file($filepath)) {
throw new Exception(t('Archivers can only operate on local files: %file not supported', array('%file' => $file)));
}
$archiver_info = archiver_get_info();
for... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-355328a0c9 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21menu.inc/function/menu_link_save/7.x | Implement `menu_link_save(&$item, $existing_item = array(), $parent_candidates = array())` in PHP for Drupal 7. Required behavior: Saves a menu link. | After calling this function, rebuild the menu cache using menu_cache_clear_all().
Parameters:
- $item: An associative array representing a menu link item, with elements: - link_path: (required) The path of the menu item, which should be normalized first by calling drupal_get_normal_path() on it. - link_title: (require... | function menu_link_save(&$item, $existing_item = array(), $parent_candidates = array()) {
drupal_alter('menu_link', $item);
// This is the easiest way to handle the unique internal path '<front>',
// since a path marked as external does not need to match a router path.
$item['external'] = (url_is_external($ite... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-355b0649ec | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_build_content/7.x | In Drupal 7, write the function `user_build_content($account, $view_mode = 'full', $langcode = NULL)` (file modules/user/user.module) so that it does the following: Builds a structured array representing the profile content. | Parameters:
- $account: A user object.
- $view_mode: View mode, e.g. 'full'.
- $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.
File: modules/user/user.module | function user_build_content($account, $view_mode = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->language;
}
// Remove previously built content, if exists.
$account->content = array();
// Allow modules to change the view mode.
$view_mode = key(entity_vi... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-358ffbb112 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21session.inc/function/_drupal_session_destroy/7.x | I need the code for `_drupal_session_destroy($sid)` in Drupal 7 (includes/session.inc). It must do this: Session handler assigned by session_set_save_handler(). | Cleans up a specific session.
Parameters:
- $sid: Session ID.
File: includes/session.inc | function _drupal_session_destroy($sid) {
global $user, $is_https;
// Nothing to do if we are not allowed to change the session.
if (!drupal_save_session()) {
return TRUE;
}
// Delete session data.
db_delete('sessions')
->condition($is_https ? 'ssid' : 'sid', drupal_session_id($sid))
->execute(... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-359be612ed | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.admin.inc/function/_system_is_incompatible/7.x | I need the code for `_system_is_incompatible(&$incompatible, $files, $file)` in Drupal 7 (modules/system/system.admin.inc). It must do this: Recursively check compatibility. | Parameters:
- $incompatible: An associative array which at the end of the check contains all incompatible files as the keys, their values being TRUE.
- $files: The set of files that will be tested.
- $file: The file at which the check starts.
Returns: Returns TRUE if an incompatible file is found, NULL (no return valu... | function _system_is_incompatible(&$incompatible, $files, $file) {
if (isset($incompatible[$file->name])) {
return TRUE;
}
// Recursively traverse required modules, looking for incompatible modules.
foreach ($file->requires as $requires) {
if (isset($files[$requires]) && _system_is_incompatible($incompat... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35a649972f | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21update%21update.authorize.inc/function/_update_authorize_clear_update_status/7.x | Implement `_update_authorize_clear_update_status()` in PHP for Drupal 7. Required behavior: Clears cached available update status data. | Since this function is run at such a low bootstrap level, the Update Manager module is not loaded. So, we can't just call _update_cache_clear(). However, the database is bootstrapped, so we can do a query ourselves to clear out what we want to clear.
Note that we do not want to just truncate the table, since that woul... | function _update_authorize_clear_update_status() {
$query = db_delete('cache_update');
$query->condition(
db_or()
->condition('cid', 'update_project_%', 'LIKE')
->condition('cid', 'available_releases::%', 'LIKE')
);
$query->execute();
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35ab70b1de | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21ajax.inc/function/ajax_command_add_css/7.x | I need the code for `ajax_command_add_css($styles)` in Drupal 7 (includes/ajax.inc). It must do this: Creates a Drupal Ajax 'add_css' command. | This method will add css via ajax in a cross-browser compatible way.
This command is implemented by Drupal.ajax.prototype.commands.add_css() defined in misc/ajax.js.
Parameters:
- $styles: A string that contains the styles to be added.
Returns: An array suitable for use with the ajax_render() function.
File: includ... | function ajax_command_add_css($styles) {
return array(
'command' => 'add_css',
'data' => $styles,
);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35b9007259 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field_ui%21field_ui.admin.inc/function/field_ui_get_destinations/7.x | Implement `field_ui_get_destinations($destinations)` in PHP for Drupal 7. Required behavior: Extracts next redirect path from an array of multiple destinations. | File: modules/field_ui/field_ui.admin.inc | function field_ui_get_destinations($destinations) {
$path = array_shift($destinations);
$options = drupal_parse_url($path);
if ($destinations) {
$options['query']['destinations'] = $destinations;
}
return array($options['path'], $options);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35bdfa631c | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21comment%21comment.admin.inc/function/comment_admin_overview_submit/7.x | I need the code for `comment_admin_overview_submit($form, &$form_state)` in Drupal 7 (modules/comment/comment.admin.inc). It must do this: Process comment_admin_overview form submissions. | Execute the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.
File: modules/comment/comment.admin.inc | function comment_admin_overview_submit($form, &$form_state) {
$operation = $form_state['values']['operation'];
$cids = $form_state['values']['comments'];
if ($operation == 'delete') {
comment_delete_multiple($cids);
}
else {
foreach ($cids as $cid => $value) {
$comment = comment_load($value);
... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35bf68312a | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21profile%21profile.module/function/profile_theme/7.x | I need the code for `profile_theme()` in Drupal 7 (modules/profile/profile.module). It must do this: Implements hook_theme(). | File: modules/profile/profile.module | function profile_theme() {
return array(
'profile_block' => array(
'variables' => array('account' => NULL, 'fields' => array()),
'template' => 'profile-block',
),
'profile_listing' => array(
'variables' => array('account' => NULL, 'fields' => array()),
'template' => 'profile-listin... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-35df32992e | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_set/7.x | In Drupal 7, write the function `variable_set($name, $value)` (file includes/bootstrap.inc) so that it does the following: Sets a persistent variable. | Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.
Parameters:
- $name: The name of the variable to set.
- $value: The value to set. This can be any PHP data type; these functions take care of serialization as nec... | function variable_set($name, $value) {
global $conf;
db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();
cache_clear_all('variables', 'cache_bootstrap');
$conf[$name] = $value;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35f206b283 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_page/7.x | In Drupal 7, show an example implementation for `hook_search_page($results)` (modules/search/search.api.php): Override the rendering of search results. | A module that implements hook_search_info() to define a type of search may implement this hook in order to override the default theming of its search results, which is otherwise themed using theme('search_results').
Note that by default, theme('search_results') and theme('search_result') work together to create an ord... | function hook_search_page($results) {
$output['prefix']['#markup'] = '<ol class="search-results">';
foreach ($results as $entry) {
$output[] = array(
'#theme' => 'search_result',
'#result' => $entry,
'#module' => 'my_module_name',
);
}
$output['suffix']['#markup'] = '</ol>' . theme('p... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-35f26c2550 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.info.inc/function/_field_info_collate_types/7.x | I need the code for `_field_info_collate_types($reset = FALSE)` in Drupal 7 (modules/field/field.info.inc). It must do this: Collates all information on field types, widget types and related structures. | Parameters:
- $reset: If TRUE, clear the cache. The information will be rebuilt from the database next time it is needed. Defaults to FALSE.
Returns: If $reset is TRUE, nothing. If $reset is FALSE, an array containing the following elements: - 'field types': Array of hook_field_info() results, keyed by field_type. Eac... | function _field_info_collate_types($reset = FALSE) {
global $language;
static $info;
// The _info() hooks invoked below include translated strings, so each
// language is cached separately.
$langcode = $language->language;
if ($reset) {
$info = NULL;
// Clear all languages.
cache_clear_all('fi... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-35f838fc7d | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21modules%21number%21number.module/function/number_field_widget_validate/7.x | In Drupal 7, write the function `number_field_widget_validate($element, &$form_state)` (file modules/field/modules/number/number.module) so that it does the following: FAPI validation of an individual number element. | File: modules/field/modules/number/number.module | function number_field_widget_validate($element, &$form_state) {
$field = field_widget_field($element, $form_state);
$instance = field_widget_instance($element, $form_state);
$type = $element['#number_type'];
$value = $element['#value'];
// Reject invalid characters.
if (!empty($value)) {
switch ($type... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-36097c0e35 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21color%21color.module/function/color_palette_color_value/7.x | I need the code for `color_palette_color_value($element, $input = FALSE, $form_state = array())` in Drupal 7 (modules/color/color.module). It must do this: Determines the value for a palette color field. | Parameters:
- $element: The form element whose value is being populated.
- $input: The incoming input to populate the form element. If this is FALSE, the element's default value should be returned.
- $form_state: A keyed array containing the current state of the form.
Returns: The data that will appear in the $form_st... | function color_palette_color_value($element, $input = FALSE, $form_state = array()) {
// If we suspect a possible cross-site request forgery attack, only accept
// hexadecimal CSS color strings from user input, to avoid problems when this
// value is used in the JavaScript preview.
if ($input !== FALSE) {
/... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-361b398240 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_file_copy/7.x | Give me the example code for `hook_file_copy($file, $source)` in Drupal 7. Hook description: Respond to a file that has been copied. | Parameters:
- $file: The newly copied file object.
- $source: The original file before the copy.
File: modules/system/system.api.php | function hook_file_copy($file, $source) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', 'Copied f... | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-363dd79ef4 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21comment%21comment.module/function/comment_node_view/7.x | Implement `comment_node_view($node, $view_mode)` in PHP for Drupal 7. Required behavior: Implements hook_node_view(). | File: modules/comment/comment.module | function comment_node_view($node, $view_mode) {
$links = array();
if ($node->comment != COMMENT_NODE_HIDDEN) {
if ($view_mode == 'rss') {
// Add a comments RSS element which is a URL to the comments of this node.
$node->rss_elements[] = array(
'key' => 'comments',
'value' => url('no... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-364aa88edc | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21form.inc/function/password_confirm_validate/7.x | Implement `password_confirm_validate($element, &$element_state)` in PHP for Drupal 7. Required behavior: Validates a password_confirm element. | File: includes/form.inc | function password_confirm_validate($element, &$element_state) {
$pass1 = trim($element['pass1']['#value']);
$pass2 = trim($element['pass2']['#value']);
if (strlen($pass1) > 0 || strlen($pass2) > 0) {
if (strcmp($pass1, $pass2)) {
form_error($element, t('The specified passwords do not match.'));
}
... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-366ac776a8 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21search%21search.module/function/search_reindex/7.x | Implement `search_reindex($sid = NULL, $module = NULL, $reindex = FALSE)` in PHP for Drupal 7. Required behavior: Clears a part of or the entire search index. | Parameters:
- $sid: (optional) The ID of the item to remove from the search index. If specified, $module must also be given. Omit both $sid and $module to clear the entire search index.
- $module: (optional) The machine-readable name of the module for the item to remove from the search index.
File: modules/search/sear... | function search_reindex($sid = NULL, $module = NULL, $reindex = FALSE) {
if ($module == NULL && $sid == NULL) {
module_invoke_all('search_reset');
}
else {
db_delete('search_dataset')
->condition('sid', $sid)
->condition('type', $module)
->execute();
db_delete('search_index')
-... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-366d08b265 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21image%21image.module/function/image_path_flush/7.x | Implement `image_path_flush($path)` in PHP for Drupal 7. Required behavior: Clears cached versions of a specific file in all styles. | Parameters:
- $path: The Drupal file path to the original image.
File: modules/image/image.module | function image_path_flush($path) {
$styles = image_styles();
foreach ($styles as $style) {
$image_path = image_style_path($style['name'], $path);
if (file_exists($image_path)) {
file_unmanaged_delete($image_path);
}
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-367af58ba0 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21form.inc/function/form_set_cache/7.x | Implement `form_set_cache($form_build_id, $form, $form_state)` in PHP for Drupal 7. Required behavior: Stores a form in the cache. | File: includes/form.inc | function form_set_cache($form_build_id, $form, $form_state) {
// The default cache_form expiration is 6 hours. On busy sites, the cache_form
// table can become very large. A shorter cache lifetime can help to keep the
// table's size under control.
$expire = variable_get('form_cache_expiration', 21600);
// ... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-367c0e5b56 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21common.inc/function/watchdog_severity_levels/7.x | I need the code for `watchdog_severity_levels()` in Drupal 7 (includes/common.inc). It must do this: Returns a list of severity levels, as defined in RFC 3164. | Returns (Array): of the possible severity levels for log messages.
File: includes/common.inc | function watchdog_severity_levels() {
return array(
WATCHDOG_EMERGENCY => t('emergency'),
WATCHDOG_ALERT => t('alert'),
WATCHDOG_CRITICAL => t('critical'),
WATCHDOG_ERROR => t('error'),
WATCHDOG_WARNING => t('warning'),
WATCHDOG_NOTICE => t('notice'),
WATCHDOG_INFO => t(... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-368691aee2 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21shortcut%21shortcut.admin.inc/function/shortcut_link_delete_submit/7.x | I need the code for `shortcut_link_delete_submit($form, &$form_state)` in Drupal 7 (modules/shortcut/shortcut.admin.inc). It must do this: Submit handler for shortcut_link_delete_submit(). | File: modules/shortcut/shortcut.admin.inc | function shortcut_link_delete_submit($form, &$form_state) {
$shortcut_link = $form_state['values']['shortcut_link'];
menu_link_delete($shortcut_link['mlid']);
$form_state['redirect'] = 'admin/config/user-interface/shortcut/' . $shortcut_link['menu_name'];
drupal_set_message(t('The shortcut %title has been delet... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-36942528c6 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21poll%21poll.module/function/poll_help/7.x | Implement `poll_help($path, $arg)` in PHP for Drupal 7. Required behavior: Implements hook_help(). | File: modules/poll/poll.module | function poll_help($path, $arg) {
switch ($path) {
case 'admin/help#poll':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Poll module can be used to create simple surveys or questionnaires that display cumulative results. A poll is a good way to receive feedbac... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-36a803cc58 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21menu.inc/function/_menu_tree_data/7.x | Implement `_menu_tree_data(&$links, $parents, $depth)` in PHP for Drupal 7. Required behavior: Builds the data representing a menu tree. | The function is a bit complex because the rendering of a link depends on the next menu link.
File: includes/menu.inc | function _menu_tree_data(&$links, $parents, $depth) {
$tree = array();
while ($item = array_pop($links)) {
// We need to determine if we're on the path to root so we can later build
// the correct active trail and breadcrumb.
$item['in_active_trail'] = in_array($item['mlid'], $parents);
// Add the c... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-36b649b5b4 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21form.inc/function/weight_value/7.x | Implement `weight_value(&$form)` in PHP for Drupal 7. Required behavior: Sets the value for a weight element, with zero as a default. | File: includes/form.inc | function weight_value(&$form) {
if (isset($form['#default_value'])) {
$form['#value'] = $form['#default_value'];
}
else {
$form['#value'] = 0;
}
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-36dba7a052 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.install/function/system_update_7063/7.x | In Drupal 7, write the function `system_update_7063()` (file modules/system/system.install) so that it does the following: Delete {menu_links} records for 'type' => MENU_CALLBACK which would not appear in a fresh install. | File: modules/system/system.install | function system_update_7063() {
// For router items where 'type' => MENU_CALLBACK, {menu_router}.type is
// stored as 4 in Drupal 6, and 0 in Drupal 7. Fortunately Drupal 7 doesn't
// store any types as 4, so delete both.
$result = db_query('SELECT ml.mlid FROM {menu_links} ml INNER JOIN {menu_router} mr ON ml.... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-36efac515b | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21module.inc/function/drupal_required_modules/7.x | In Drupal 7, write the function `drupal_required_modules()` (file includes/module.inc) so that it does the following: Returns an array of modules required by core. | File: includes/module.inc | function drupal_required_modules() {
$files = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'modules', 'name', 0);
$required = array();
// An installation profile is required and one must always be loaded.
$required[] = drupal_get_profile();
foreach ($files as $name => $file) {
... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-370e2be0c3 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_filters/7.x | Implement `user_filters()` in PHP for Drupal 7. Required behavior: List user administration filters that can be applied. | File: modules/user/user.module | function user_filters() {
// Regular filters
$filters = array();
$roles = user_roles(TRUE);
unset($roles[DRUPAL_AUTHENTICATED_RID]); // Don't list authorized role.
if (count($roles)) {
$filters['role'] = array(
'title' => t('role'),
'field' => 'ur.rid',
'options' => array(
'[any]... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-371fee4d67 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21help%21help.admin.inc/function/help_page/7.x | I need the code for `help_page($name)` in Drupal 7 (modules/help/help.admin.inc). It must do this: Menu callback; prints a page listing general help for a module. | Parameters:
- $name: A module name to display a help page for.
File: modules/help/help.admin.inc | function help_page($name) {
$output = '';
if (module_hook($name, 'help')) {
$info = system_get_info('module');
drupal_set_title($info[$name]['name']);
$temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
if (empty($temp)) {
$output .= t("No help is available for module... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-3730f87187 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/profiles%21standard%21standard.profile/function/standard_form_install_configure_form_alter/7.x | Implement `standard_form_install_configure_form_alter(&$form, $form_state)` in PHP for Drupal 7. Required behavior: Implements hook_form_FORM_ID_alter() for install_configure_form(). | Allows the profile to alter the site configuration form.
File: profiles/standard/standard.profile | function standard_form_install_configure_form_alter(&$form, $form_state) {
// Pre-populate the site name with the server name.
$form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME'];
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-37375b3327 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_load/7.x | Implement `user_load($uid, $reset = FALSE)` in PHP for Drupal 7. Required behavior: Loads a user object. | Drupal has a global $user object, which represents the currently-logged-in user. So to avoid confusion and to avoid clobbering the global $user object, it is a good idea to assign the result of this function to a different local variable, generally $account. If you actually do want to act as the user you are loading, i... | function user_load($uid, $reset = FALSE) {
$users = user_load_multiple(array($uid), array(), $reset);
return reset($users);
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-37406685a9 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.api.php/function/hook_taxonomy_vocabulary_delete/7.x | Give me the example code for `hook_taxonomy_vocabulary_delete($vocabulary)` in Drupal 7. Hook description: Respond to the deletion of taxonomy vocabularies. | Modules implementing this hook can respond to the deletion of taxonomy vocabularies from the database.
Parameters:
- $vocabulary: A taxonomy vocabulary object.
File: modules/taxonomy/taxonomy.api.php | function hook_taxonomy_vocabulary_delete($vocabulary) {
db_delete('mytable')
->condition('vid', $vocabulary->vid)
->execute();
} | [
"code-task",
"hook-definition"
] | 2026-09-30T00:00:00 |
api-drupal7-3786770f20 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21block%21block.module/function/block_menu_delete/7.x | Implement `block_menu_delete($menu)` in PHP for Drupal 7. Required behavior: Implements hook_menu_delete(). | File: modules/block/block.module | function block_menu_delete($menu) {
db_delete('block')
->condition('module', 'menu')
->condition('delta', $menu['menu_name'])
->execute();
db_delete('block_role')
->condition('module', 'menu')
->condition('delta', $menu['menu_name'])
->execute();
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-379f8248a2 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_get/7.x | I need the code for `variable_get($name, $default = NULL)` in Drupal 7 (includes/bootstrap.inc). It must do this: Returns a persistent variable. | Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.
Parameters:
- $name: The name of the variable to return.
- $default: The default value to use if this variable has never been set.
Returns: The value of the vari... | function variable_get($name, $default = NULL) {
global $conf;
return isset($conf[$name]) ? $conf[$name] : $default;
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-379fb0c2d2 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/includes%21file.inc/function/file_download/7.x | In Drupal 7, write the function `file_download()` (file includes/file.inc) so that it does the following: Menu handler for private file transfers. | Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If one or more modules returned headers the download will start with the returned headers. If a module returns -1 drupal_access_denied() will be returned. If the file exists but no module... | function file_download() {
// Merge remainder of arguments from GET['q'], into relative file path.
$args = func_get_args();
$scheme = array_shift($args);
$target = implode('/', $args);
$uri = $scheme . '://' . $target;
$uri = file_uri_normalize_dot_segments($uri);
if (file_stream_wrapper_valid_scheme($sch... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-37a6716761 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21shortcut%21shortcut.module/function/shortcut_block_view/7.x | Implement `shortcut_block_view($delta = '')` in PHP for Drupal 7. Required behavior: Implements hook_block_view(). | File: modules/shortcut/shortcut.module | function shortcut_block_view($delta = '') {
if ($delta == 'shortcuts') {
$shortcut_set = shortcut_current_displayed_set();
$data['subject'] = t('@shortcut_set shortcuts', array('@shortcut_set' => $shortcut_set->title));
$data['content'] = shortcut_renderable_links($shortcut_set);
return $data;
}
} | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-37ab6ac85a | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21filter%21filter.module/function/filter_access/7.x | In Drupal 7, write the function `filter_access($format, $account = NULL)` (file modules/filter/filter.module) so that it does the following: Checks if a user has access to a particular text format. | Parameters:
- $format: An object representing the text format.
- $account: (optional) The user account to check access for; if omitted, the currently logged-in user is used. Defaults to NULL.
Returns (Boolean): TRUE if the user is allowed to access the given format.
File: modules/filter/filter.module | function filter_access($format, $account = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
// Handle special cases up front. All users have access to the fallback
// format.
if ($format->format == filter_fallback_format()) {
return TRUE;
}
// Check the permission if one exists;... | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-37c5ec6604 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21field%21field.info.inc/function/field_info_field_settings/7.x | I need the code for `field_info_field_settings($type)` in Drupal 7 (modules/field/field.info.inc). It must do this: Returns a field type's default settings. | Parameters:
- $type: A field type name.
Returns: The field type's default settings, as provided by hook_field_info(), or an empty array if type or settings are not defined.
File: modules/field/field.info.inc | function field_info_field_settings($type) {
$info = field_info_field_types($type);
return isset($info['settings']) ? $info['settings'] : array();
} | [
"code-task",
"function"
] | 2026-09-30T00:00:00 |
api-drupal7-37cdeac726 | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21system%21system.tokens.inc/function/system_token_info/7.x | Implement `system_token_info()` in PHP for Drupal 7. Required behavior: Implements hook_token_info(). | File: modules/system/system.tokens.inc | function system_token_info() {
$types['site'] = array(
'name' => t("Site information"),
'description' => t("Tokens for site-wide settings and other global information."),
);
$types['date'] = array(
'name' => t("Dates"),
'description' => t("Tokens related to times and dates."),
);
$types['file'... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
api-drupal7-37cf5d537d | 7 | drupal_api_code | https://api.drupal.org/api/drupal/modules%21overlay%21overlay.module/function/overlay_overlay_child_initialize/7.x | I need the code for `overlay_overlay_child_initialize()` in Drupal 7 (modules/overlay/overlay.module). It must do this: Implements hook_overlay_child_initialize(). | File: modules/overlay/overlay.module | function overlay_overlay_child_initialize() {
// Check if the parent window needs to refresh any page regions on this page
// request.
overlay_trigger_refresh();
// If this is a POST request, or a GET request with a token parameter, we
// have an indication that something in the supplemental regions of the
... | [
"code-task",
"hook-implementation"
] | 2026-09-30T00:00:00 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.