当前位置: 首页>>代码示例>>PHP>>正文


PHP module_invoke函数代码示例

本文整理汇总了PHP中module_invoke函数的典型用法代码示例。如果您正苦于以下问题:PHP module_invoke函数的具体用法?PHP module_invoke怎么用?PHP module_invoke使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了module_invoke函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testEnable

 /**
  * Test successful execution of hook_requirements() during install/enable.
  *
  * Function module_enable() does not check requirements, unlike normal
  * enabling, so we need to invoke the hook manually to simulate it.
  */
 public function testEnable()
 {
     module_load_install(static::MODULE);
     module_invoke(static::MODULE, 'requirements', 'install');
     module_enable([static::MODULE], FALSE);
     $this->pass('Successfully enabled mongodb.module.');
 }
开发者ID:pjcdawkins,项目名称:drupal7mongodb,代码行数:13,代码来源:PackageManagementTest.php

示例2: update_script_selection_form

function update_script_selection_form()
{
    $form = array();
    $form['start'] = array('#tree' => TRUE, '#type' => 'fieldset', '#title' => 'Select versions', '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Ensure system.module's updates appear first
    $form['start']['system'] = array();
    $modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
    foreach ($modules as $module => $schema_version) {
        $updates = drupal_get_schema_versions($module);
        // Skip incompatible module updates completely, otherwise test schema versions.
        if (!update_check_incompatibility($module) && $updates !== FALSE && $schema_version >= 0) {
            // module_invoke returns NULL for nonexisting hooks, so if no updates
            // are removed, it will == 0.
            $last_removed = module_invoke($module, 'update_last_removed');
            if ($schema_version < $last_removed) {
                $form['start'][$module] = array('#value' => '<em>' . $module . '</em> module can not be updated. Its schema version is ' . $schema_version . '. Updates up to and including ' . $last_removed . ' have been removed in this release. In order to update <em>' . $module . '</em> module, you will first <a href="http://drupal.org/upgrade">need to upgrade</a> to the last version in which these updates were available.', '#prefix' => '<div class="warning">', '#suffix' => '</div>');
                $form['start']['#collapsed'] = FALSE;
                continue;
            }
            $updates = drupal_map_assoc($updates);
            $updates[] = 'No updates available';
            $default = $schema_version;
            foreach (array_keys($updates) as $update) {
                if ($update > $schema_version) {
                    $default = $update;
                    break;
                }
            }
            $form['start'][$module] = array('#type' => 'select', '#title' => $module . ' module', '#default_value' => $default, '#options' => $updates);
        }
    }
    $form['has_js'] = array('#type' => 'hidden', '#default_value' => FALSE);
    $form['submit'] = array('#type' => 'submit', '#value' => 'Update');
    return $form;
}
开发者ID:nguyennamtien,项目名称:system_settings,代码行数:35,代码来源:recovery.php

示例3: doRenderBlock

 /**
  * Render a Drupal block
  */
 public function doRenderBlock($module, $delta)
 {
     // $block = block_load($module, $delta);
     $blocks = module_invoke($module, 'block_info');
     if (!isset($blocks[$delta])) {
         return;
     }
     $block = (object) $blocks[$delta];
     $block->module = $module;
     $block->delta = $delta;
     $block->status = 1;
     $block->region = 'content';
     $block->weight = 0;
     $block->theme = $GLOBALS['theme_key'];
     // Those won't serve any purpose but avoid nasty PHP warnings
     $block->title = '';
     $block->pages = '';
     $block->visibility = 0;
     // BLOCK_VISIBILITY_NOTLISTED (block module could be disabled)
     $block->custom = null;
     $blockList = [$block];
     drupal_alter('block_list', $blockList);
     $render_array = _block_get_renderable_array(_block_render_blocks($blockList));
     return drupal_render($render_array);
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:28,代码来源:DrupalBlockExtension.php

示例4: actionSearch

 public function actionSearch()
 {
     if (isset($_POST['keyword'])) {
         $keyword = $_POST['keyword'];
     } else {
         $basic = new basic();
         $basic->error_code = 1;
         $basic->error_msg = "no input parameters";
         $jsonObj = CJSON::encode($basic);
         echo $jsonObj;
         die(0);
     }
     $info = search_get_default_module_info();
     $contentTypes = ' type:article,multi,_xinwen';
     $results = module_invoke('search', 'data', $keyword . $contentTypes, $info['module']);
     $searchback['error_code'] = 0;
     $list = array();
     if ($results['#results']) {
         foreach ($results['#results'] as $result) {
             //var_dump($result);
             $search['title'] = $result['title'];
             if ($result['type'] == '(类型2)多图新闻') {
                 $search['type'] = 2;
             } else {
                 $search['type'] = 1;
             }
             $search['createtime'] = date('Y-m-d H:i:s', $result['date']);
             $search['nid'] = $result['node']->nid;
             array_push($list, $search);
         }
     }
     $searchback['results'] = $list;
     $jsonObj = CJSON::encode($searchback);
     echo $jsonObj;
 }
开发者ID:dingruoting,项目名称:tydaily,代码行数:35,代码来源:NewsController_before+ads.php

示例5: blendedmalts_viewadjust

function blendedmalts_viewadjust(&$vars, $mode = "node")
{
    // Get the node object
    $node =& $vars['node'];
    include_once 'sites/all/modules/wisski_pathbuilder/wisski_pathbuilder.inc';
    if (!empty($node) && !empty($node->title)) {
        $groupid = wisski_pathbuilder_getGroupIDForIndividual(wisski_store_getObj()->wisski_ARCAdapter_delNamespace($node->title));
    }
    if (!$groupid || !isset($groupid)) {
        return;
    }
    if ($mode == "page") {
        $vars['maltedtitle'] = wisski_pathbuilder_generateGroupName($node->title, $groupid);
    } else {
        if ($mode == "node") {
            // this relies on the output of wisski_view() char by char
            // so first see there or in alter hooks if something broke
            if (strpos($vars['content'], '<div id="wki-content-other"></div>') !== FALSE) {
                // this is for the newest wisski_view() version (39ee47a0ef)
                // we wrap the div wki-content-other around all other/following content
                // (e.g. file attachments)
                $vars['maltedcontent'] = str_replace('<div id="wki-content-other"></div>', '<div id="wki-content-other">', $vars['content']) . '</div>';
            } elseif (strpos($vars['content'], '<div id="wki-content-right">') === FALSE) {
                // this is for the very old wisski_view() (fbb0f44f66) which effectively
                // does nothing. construct the wisski content in the old fashion and add
                // further content.
                $block2 = module_invoke('wisski_pathbuilder', 'block', 'view', 0);
                $block1 = module_invoke('wisski_pathbuilder', 'block', 'view', 1);
                $vars['maltedcontent'] = '<div id="wki-content-right">' . $block2['content'] . '</div>' . '<div id="wki-content-left">' . $block1['content'] . '</div><div id="wki-content-other">' . $vars['content'] . '</div>';
            }
            // for the version in between we do nothing and let the default theming put
            // the content together
        }
    }
}
开发者ID:blumenbach,项目名称:blendedmalts,代码行数:35,代码来源:template.php

示例6: settingsForm

 /**
  * Generate a settings form for this handler.
  */
 public function settingsForm($field, $instance)
 {
     $field_name = $field['field_name'];
     $form['action'] = array('#type' => 'select', '#title' => t('Action'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'disable' => t('Disable field')), '#description' => t('Action to take when prepopulating field with values via URL.'));
     $form['action_on_edit'] = array('#type' => 'checkbox', '#title' => t('Apply action on edit'), '#description' => t('Apply action when editing an existing entity.'), '#states' => array('invisible' => array(':input[name="instance[settings][behaviors][prepopulate][action]"]' => array('value' => 'none'))));
     $form['fallback'] = array('#type' => 'select', '#title' => t('Fallback behaviour'), '#description' => t('Determine what should happen if no values are provided via URL.'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'form_error' => t('Set form error'), 'redirect' => t('Redirect')));
     // Get list of permissions.
     $perms = array();
     $perms[0] = t('- None -');
     foreach (module_list(FALSE, FALSE, TRUE) as $module) {
         // By keeping them keyed by module we can use optgroups with the
         // 'select' type.
         if ($permissions = module_invoke($module, 'permission')) {
             foreach ($permissions as $id => $permission) {
                 $perms[$module][$id] = strip_tags($permission['title']);
             }
         }
     }
     $form['skip_perm'] = array('#type' => 'select', '#title' => t('Skip access permission'), '#description' => t('Set a permission that will not be affected by the fallback behavior.'), '#options' => $perms);
     $description = t('Determine if values that should be prepopulated should "listen" to the OG-context.');
     if ($disabled = !module_exists('og_context') || !og_is_group_audience_field($field_name)) {
         $description .= '<br / >' . t('Organic groups integration: Enable OG-context and set "Entity selection mode" to "Organic groups" to enable this selection.');
     }
     $form['og_context'] = array('#type' => 'checkbox', '#title' => t('OG context'), '#description' => $description, '#disabled' => $disabled);
     return $form;
 }
开发者ID:swarad07,项目名称:india-standalone-drupal,代码行数:29,代码来源:EntityReferencePrepopulateInstanceBehavior.class.php

示例7: odsherredweb_preprocess_page

/**
 * implements hook_preprocess_page()
 *
 **/
function odsherredweb_preprocess_page(&$variables)
{
    $current_theme = variable_get('theme_default', 'none');
    // Search form
    $variables['simple_navigation_search'] = module_invoke('search', 'block_view', 'search');
    // Navigation
    $variables['sidebar_borger'] = _bellcom_generate_menu('menu-indhold', 'sidebar');
    $variables['sidebar_erhverv'] = _bellcom_generate_menu('menu-erhverv', 'sidebar');
    $variables['sidebar_politik'] = _bellcom_generate_menu('menu-politik', 'sidebar');
    // Add the site structure term id to the page div
    $node = node_load(arg(1));
    if (is_object($node) && isset($node->field_os2web_spotbox_sitestruct)) {
        $termParents = taxonomy_get_parents($node->field_os2web_spotbox_sitestruct[LANGUAGE_NONE][0]['tid']);
        $termId = 'tid-' . $node->field_os2web_spotbox_sitestruct[LANGUAGE_NONE][0]['tid'];
        $termIdParent = "";
        if (!empty($termParents)) {
            $termIdParent = 'tid-' . key($termParents);
        }
        $variables['attributes_array']['class'] = $termIdParent . ' ' . $termId;
    }
    // Paths
    $variables['path_js'] = base_path() . drupal_get_path('theme', $current_theme) . '/js';
    $variables['path_img'] = base_path() . drupal_get_path('theme', $current_theme) . '/images';
    $variables['path_css'] = base_path() . drupal_get_path('theme', $current_theme) . '/css';
    $variables['path_font'] = base_path() . drupal_get_path('theme', $current_theme) . '/font';
}
开发者ID:odsherred,项目名称:odsherred.dk,代码行数:30,代码来源:template.php

示例8: settingsForm

 /**
  * Override EntityReferenceHandler::settingsForm().
  */
 public function settingsForm($field, $instance)
 {
     $form = parent::settingsForm($field, $instance);
     $settings = !empty($instance['settings']['behaviors']['og_widget']) ? $instance['settings']['behaviors']['og_widget'] : array();
     $settings += array('default' => array('widget_type' => 'options_select', 'widget_settings' => array()), 'admin' => array('widget_type' => 'entityreference_autocomplete', 'widget_settings' => array()));
     $field_types = array('default' => array('title' => t('Default widget type'), 'description' => t('The widget type of the field as it will appear to the user.')), 'admin' => array('title' => t('Administrator widget type'), 'description' => t('The widget type of the field that will appear only to a user with "Administer group" permission.')));
     module_load_include('inc', 'field_ui', 'field_ui.admin');
     $widget_types = field_ui_widget_type_options('entityreference');
     unset($widget_types['og_complex']);
     $field_info_widget_types = field_info_widget_types();
     foreach ($field_types as $field_type => $value) {
         $settings_id = 'og-' . $field_type . '-settings';
         $form[$field_type]['widget_type'] = array('#type' => 'select', '#title' => $value['title'], '#required' => TRUE, '#options' => $widget_types, '#default_value' => $settings[$field_type]['widget_type'], '#description' => $value['description'], '#ajax' => array('callback' => 'og_' . $field_type . '_settings_form_ajax', 'wrapper' => $settings_id, 'method' => 'replace', 'event' => 'change'));
         $form[$field_type]['widget_settings'] = array('#type' => 'fieldset', '#title' => t('@title Settings', array('@title' => $value['title'])), '#tree' => TRUE, '#attributes' => array('id' => $settings_id));
         if ($settings[$field_type]['widget_type'] && !empty($field_info_widget_types[$settings[$field_type]['widget_type']])) {
             $widget_type = $field_info_widget_types[$settings[$field_type]['widget_type']];
             $current_settings = isset($settings[$field_type]['widget_settings']) ? $settings[$field_type]['widget_settings'] : array();
             $fake_instance = array('widget' => array('type' => $settings[$field_type]['widget_type'], 'module' => $widget_type['module'], 'settings' => $current_settings) + $instance['widget']) + $instance;
             $additions = module_invoke($widget_type['module'], 'field_widget_settings_form', $field, $fake_instance);
             if ($additions) {
                 $form[$field_type]['widget_settings'] += $additions;
             }
         }
     }
     // Field access settings.
     $form['access_override'] = array('#title' => t('Allow entity access to control field access'), '#description' => t('By default, the <em>administer group</em> permission is required to directly edit this field. Selecting this option will allow access to anybody with access to edit the entity.'), '#type' => 'checkbox', '#default_value' => isset($settings['access_override']) ? $settings['access_override'] : FALSE);
     return $form;
 }
开发者ID:redponey,项目名称:openatrium-7.x-2.51,代码行数:31,代码来源:OgWidgetHandler.class.php

示例9: get_valid_address_list

 /**
  * Return a list of valid addresses where key = email address and value = associated UID.
  * EG. $array['admin@example.com'] = 1
  * 
  * @return list of valid addresses
  */
 private function get_valid_address_list()
 {
     // Define a hook -- this plugin is intended to be used with mailhandler_singlebox
     // but it could be implemented using another email address to uid mapping function.
     $addresses = array();
     foreach (module_implements('mailhandler_sendto_addresses') as $module) {
         $addresses += module_invoke($module, 'mailhandler_sendto_addresses');
     }
     return $addresses;
 }
开发者ID:Chaogan-Yan,项目名称:rfmri.org,代码行数:16,代码来源:MailhandlerAuthenticateSendto.class.php

示例10: _groupadmin_get_modules

/**
 * Get data from other modules via hook_groupadmin_ functions.
 */
function _groupadmin_get_modules($op)
{
    $hook = 'hook_groupadmin_' . $op;
    $modules = module_implements($hook);
    //drupal_set_message('modules: ' . print_r($modules, 1));
    $data = array();
    foreach ($modules as $module) {
        $data = array_merge($data, module_invoke($module, $hook));
    }
    return $data;
}
开发者ID:j573fan1s,项目名称:portal,代码行数:14,代码来源:groupadmin.misc.inc.php

示例11: shelter_preprocess_page

/**
 * Implements hook_preprocess_page().
 */
function shelter_preprocess_page(&$variables)
{
    // Put the language switcher in a variable.
    $block = module_invoke('locale', 'block_view', 'language_content');
    $variables['language_switcher'] = $block['content'];
    global $base_url;
    $variables['base_url'] = $base_url;
    $current_path = current_path();
    // Adding the viewport for mobile view.
    $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, minimal-ui'));
    drupal_add_html_head($viewport, 'viewport');
    libraries_load('underscore');
    drupal_add_library('system', 'jquery.cookie');
    $variables['hot_responses'] = FALSE;
    $variables['is_regions_and_countries'] = FALSE;
    $variables['is_user_profile_pages'] = FALSE;
    $variables['is_search_documents'] = FALSE;
    $variables['global_docs_search_page_link'] = l(t('Search all documents'), 'search-documents', array('attributes' => array('class' => array('search-documents-link')), 'query' => array('sort' => 'date', 'sort_direction' => 'DESC')));
    $variables['global_events_page'] = FALSE;
    $variables['recent_documents'] = FALSE;
    if ($variables['is_front']) {
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['upcoming_events'] = cluster_events_upcoming();
        $variables['recent_documents'] = cluster_docs_recent();
    }
    if ($current_path == 'regions-countries') {
        $variables['is_regions_and_countries'] = TRUE;
    }
    if ($current_path == 'search-documents') {
        $variables['is_search_documents'] = TRUE;
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['upcoming_events'] = NULL;
    }
    if ($current_path == 'events') {
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['global_events_page'] = TRUE;
    }
    if (arg(0) == 'user') {
        $variables['is_user_profile_pages'] = TRUE;
    }
    $variables['extra'] = FALSE;
    if (isset($variables['page']['content']['system_main']['side-column'])) {
        $variables['extra'] = $variables['page']['content']['system_main']['side-column'];
        unset($variables['page']['content']['system_main']['side-column']);
    } elseif ($node = menu_get_object()) {
        if (isset($variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column'])) {
            $variables['extra'] = $variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column'];
            unset($variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column']);
        }
    }
}
开发者ID:Global-Shelter-Cluster,项目名称:website,代码行数:54,代码来源:template.php

示例12: render_block_content

/**
 * Helper function to find and render a block by Jeremy Cerda @FreighthouseNYC
 * PS. - Necessary to support i18n
 */
function render_block_content($module, $delta)
{
    $output = '';
    if ($block = block_load($module, $delta)) {
        if ($build = module_invoke($module, 'block_view', $delta)) {
            $delta = str_replace('-', '_', $delta);
            drupal_alter(array('block_view', "block_view_{$module}_{$delta}"), $build, $block);
            if (!empty($build['content'])) {
                return is_array($build['content']) ? render($build['content']) : $build['content'];
            }
        }
    }
    return $output;
}
开发者ID:freighthouse,项目名称:code,代码行数:18,代码来源:template.php

示例13: settingsForm

 /**
  * Generate a settings form for this handler.
  */
 public function settingsForm($field, $instance)
 {
     $form['action'] = array('#type' => 'select', '#title' => t('Action'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'disable' => t('Disable field')), '#description' => t('Action to take when prepopulating field with values via URL.'));
     $form['action_on_edit'] = array('#type' => 'checkbox', '#title' => t('Apply action on edit'), '#description' => t('Apply action when editing an existing entity.'), '#states' => array('invisible' => array(':input[name="instance[settings][behaviors][prepopulate][action]"]' => array('value' => 'none'))));
     $form['fallback'] = array('#type' => 'select', '#title' => t('Fallback behaviour'), '#description' => t('Determine what should happen if no values are provided via URL.'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'form_error' => t('Set form error'), 'redirect' => t('Redirect')));
     // Get list of permissions.
     $perms = array();
     $perms[0] = t('- None -');
     foreach (module_list(FALSE, FALSE, TRUE) as $module) {
         // By keeping them keyed by module we can use optgroups with the
         // 'select' type.
         if ($permissions = module_invoke($module, 'permission')) {
             foreach ($permissions as $id => $permission) {
                 $perms[$module][$id] = strip_tags($permission['title']);
             }
         }
     }
     $form['skip_perm'] = array('#type' => 'select', '#title' => t('Skip access permission'), '#description' => t('Set a permission that will not be affected by the fallback behavior.'), '#options' => $perms);
     $form['providers'] = array('#type' => 'container', '#theme' => 'entityreference_prepopulate_providers_table', '#element_validate' => array('entityreference_prepopulate_providers_validate'));
     $providers = entityreference_prepopulate_providers_info();
     // Sort providers by weight.
     $providers_names = !empty($instance['settings']['behaviors']['prepopulate']['providers']) ? array_keys($instance['settings']['behaviors']['prepopulate']['providers']) : array();
     $providers_names = drupal_array_merge_deep($providers_names, array_keys($providers));
     $weight = 0;
     foreach ($providers_names as $name) {
         // Validate that the provider exists.
         if (!isset($providers[$name])) {
             continue;
         }
         $provider = $providers[$name];
         // Set default values.
         $provider += array('disabled' => FALSE);
         $form['providers']['title'][$name] = array('#type' => 'item', '#markup' => filter_xss($provider['title']), '#description' => filter_xss($provider['description']));
         if (!isset($instance['settings']['behaviors']['prepopulate']['providers'][$name])) {
             // backwards compatibility with version 1.4.
             if ($name == 'url') {
                 // Enable the URL provider is it is not set in the instance yet.
                 $default_value = TRUE;
             } elseif ($name == 'og_context') {
                 $default_value = !empty($instance['settings']['behaviors']['prepopulate']['og_context']);
             }
         } else {
             $default_value = !empty($instance['settings']['behaviors']['prepopulate']['providers'][$name]);
         }
         $form['providers']['enabled'][$name] = array('#type' => 'checkbox', '#disabled' => $provider['disabled'], '#default_value' => $default_value);
         $form['providers']['weight'][$name] = array('#type' => 'weight', '#default_value' => $weight, '#attributes' => array('class' => array('provider-weight')));
         ++$weight;
     }
     return $form;
 }
开发者ID:elmsln,项目名称:spawn,代码行数:53,代码来源:EntityReferencePrepopulateInstanceBehavior.class.php

示例14: hyx_preprocess_page

function hyx_preprocess_page(&$variables)
{
    if (!empty($variables['node']) && !empty($variables['node']->type)) {
        $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
    }
    // block de locale
    $variables['locale'] = module_invoke('locale', 'block_view', 'language');
    // block panier
    $variables['cart'] = module_invoke('hyx_content', 'block_view', 'hyx_cart');
    // block de recherche
    $variables['search_block_form'] = module_invoke('search_api_page', 'block_view', 'hyxsearchpage');
    // menu user
    //$variables['menu_user'] = menu_tree('user-menu');
    //$variables['logo'] = image_style_url('my_image_style', $variables['logo']);
}
开发者ID:lcube45,项目名称:hyx,代码行数:15,代码来源:template.php

示例15: redcrackle_preprocess_node

/**
 * Override or insert variables into the node template.
 */
function redcrackle_preprocess_node(&$variables)
{
    $variables['theme_hook_suggestions'][] = 'node__' . $variables['type'] . '__' . strtolower($variables['title']);
    if ($variables['type'] == 'blog') {
        $author = user_load($variables['uid']);
        $author_name = field_get_items('user', $author, 'field_name');
        $author_name = $author_name[0]['value'];
        $author_name = l($author_name, 'blog/' . $author->uid);
        $variables['author_name'] = $author_name;
        if ($variables['view_mode'] == 'full') {
            $block = module_invoke('mailchimp_signup', 'block_view', 'mailchimp_signup_1');
            $variables['newsletter_block'] = $block;
        }
    }
}
开发者ID:redcrackle,项目名称:blocks,代码行数:18,代码来源:template.php


注:本文中的module_invoke函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。