本文整理汇总了PHP中renderer_base::pix_url方法的典型用法代码示例。如果您正苦于以下问题:PHP renderer_base::pix_url方法的具体用法?PHP renderer_base::pix_url怎么用?PHP renderer_base::pix_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类renderer_base
的用法示例。
在下文中一共展示了renderer_base::pix_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_for_template
public function export_for_template(\renderer_base $output)
{
global $USER;
$context = clone $this->notification;
if ($context->useridto == $USER->id && $context->timeusertodeleted) {
$context->deleted = true;
} else {
$context->deleted = false;
}
$context->timecreatedpretty = get_string('ago', 'message', format_time(time() - $context->timecreated));
$context->text = message_format_message_text($context);
$context->read = $context->timeread ? true : false;
$context->shortenedsubject = shorten_text($context->subject, 125);
if (!empty($context->component) && substr($context->component, 0, 4) == 'mod_') {
$iconurl = $output->pix_url('icon', $context->component);
} else {
$iconurl = $output->pix_url('i/marker', 'core');
}
$context->iconurl = $iconurl->out();
return $context;
}
示例2: get_config_for_javascript
/**
* Return the safe config values that get set for javascript in "M.cfg".
*
* @since 2.9
* @return array List of safe config values that are available to javascript.
*/
public function get_config_for_javascript(moodle_page $page, renderer_base $renderer)
{
global $CFG;
if (empty($this->M_cfg)) {
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => $this->get_jsrev(), 'admin' => $CFG->admin, 'svgicons' => $page->theme->use_svg_icons());
if ($CFG->debugdeveloper) {
$this->M_cfg['developerdebug'] = true;
}
if (defined('BEHAT_SITE_RUNNING')) {
$this->M_cfg['behatsiterunning'] = true;
}
}
return $this->M_cfg;
}
示例3: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
* @return array
*/
public function export_for_template(renderer_base $output)
{
$attributes = $this->attributes;
$attributes['src'] = $output->pix_url($this->pix, $this->component);
$templatecontext = array();
foreach ($attributes as $name => $value) {
$templatecontext[] = array('name' => $name, 'value' => $value);
}
$data = array('attributes' => $templatecontext);
return $data;
}
示例4: theme_mmcmonkwearmouth_get_html_for_settings
/**
* Returns an object containing HTML for the areas affected by settings.
*
* Do not add mmcmonkwearmouth specific logic in here, child themes should be able to
* rely on that function just by declaring settings with similar names.
*
* @param renderer_base $output Pass in $OUTPUT.
* @param moodle_page $page Pass in $PAGE.
* @return stdClass An object with the following properties:
* - navbarclass A CSS class to use on the navbar. By default ''.
* - heading HTML to use for the heading. A logo if one is selected or the default heading.
* - footnote HTML to use as a footnote. By default ''.
*/
function theme_mmcmonkwearmouth_get_html_for_settings(renderer_base $output, moodle_page $page)
{
global $CFG;
$toReturn = new stdClass();
$toReturn->navbarclass = '';
if (!empty($page->theme->settings->logo)) {
$toReturn->heading = html_writer::link($CFG->wwwroot, html_writer::img($output->pix_url('logo', 'theme'), 'logo', array('title' => get_string('home'), 'class' => 'logo')) . html_writer::tag('h3', 'Monkwearmouth Academy'));
} else {
$toReturn->heading = $output->page_heading();
}
$toReturn->footnote = '';
if (!empty($page->theme->settings->footnote)) {
$toReturn->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
}
return $toReturn;
}