當前位置: 首頁>>代碼示例>>PHP>>正文


PHP js_writer::function_call_with_Y方法代碼示例

本文整理匯總了PHP中js_writer::function_call_with_Y方法的典型用法代碼示例。如果您正苦於以下問題:PHP js_writer::function_call_with_Y方法的具體用法?PHP js_writer::function_call_with_Y怎麽用?PHP js_writer::function_call_with_Y使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在js_writer的用法示例。


在下文中一共展示了js_writer::function_call_with_Y方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: js_init_call

 /**
  * Ensure that the specified JavaScript function is called from an inline script
  * from page footer.
  *
  * @param string $function the name of the JavaScritp function to with init code,
  *      usually something like 'M.mod_mymodule.init'
  * @param array $extraarguments and array of arguments to be passed to the function.
  *      The first argument is always the YUI3 Y instance with all required dependencies
  *      already loaded.
  * @param bool $ondomready wait for dom ready (helps with some IE problems when modifying DOM)
  * @param array $module JS module specification array
  */
 public function js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null)
 {
     $jscode = js_writer::function_call_with_Y($function, $extraarguments);
     if (!$module) {
         // Detect module automatically.
         if (preg_match('/M\\.([a-z0-9]+_[^\\.]+)/', $function, $matches)) {
             $module = $this->find_module($matches[1]);
         }
     }
     $this->js_init_code($jscode, $ondomready, $module);
 }
開發者ID:masaterutakeno,項目名稱:MoodleMobile,代碼行數:23,代碼來源:outputrequirementslib.php

示例2: render_custom_menu

 /**
  * Renders a custom menu object (located in outputcomponents.php)
  *
  * The custom menu this method produces makes use of the YUI3 menunav widget
  * and requires very specific html elements and classes.
  *
  * @staticvar int $menucount
  * @param custom_menu $menu
  * @return string
  */
 protected function render_custom_menu(custom_menu $menu) {
     static $menucount = 0;
     // If the menu has no children return an empty string
     if (!$menu->has_children()) {
         return '';
     }
     // Increment the menu count. This is used for ID's that get worked with
     // in JavaScript as is essential
     $menucount++;
     // Initialise this custom menu (the custom menu object is contained in javascript-static
     $jscode = js_writer::function_call_with_Y('M.core_custom_menu.init', array('custom_menu_'.$menucount));
     $jscode = "(function(){{$jscode}})";
     $this->page->requires->yui_module('node-menunav', $jscode);
     // Build the root nodes as required by YUI
     $content = html_writer::start_tag('div', array('id'=>'custom_menu_'.$menucount, 'class'=>'yui3-menu yui3-menu-horizontal javascript-disabled custom-menu'));
     $content .= html_writer::start_tag('div', array('class'=>'yui3-menu-content'));
     $content .= html_writer::start_tag('ul');
     // Render each child
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item);
     }
     // Close the open tags
     $content .= html_writer::end_tag('ul');
     $content .= html_writer::end_tag('div');
     $content .= html_writer::end_tag('div');
     // Return the custom menu
     return $content;
 }
開發者ID:afgal,項目名稱:moodle-1,代碼行數:38,代碼來源:outputrenderers.php


注:本文中的js_writer::function_call_with_Y方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。