当前位置: 首页>>代码示例>>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;未经允许,请勿转载。