本文整理汇总了PHP中renderer_base::render方法的典型用法代码示例。如果您正苦于以下问题:PHP renderer_base::render方法的具体用法?PHP renderer_base::render怎么用?PHP renderer_base::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类renderer_base
的用法示例。
在下文中一共展示了renderer_base::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_element_properties
/**
* Returns an array of properties suitable for generating a quickforms element
* @param backup_task|null $task
* @return array (element, name, label, options, attributes)
*/
public function get_element_properties(base_task $task = null, renderer_base $output = null)
{
// name, label, text, attributes
$icon = $this->get_icon();
$label = $this->get_label($task);
if (!empty($icon)) {
$label .= $output->render($icon);
}
// name, label, options, attributes
return $this->apply_options(array('element' => 'select', 'name' => self::NAME_PREFIX . $this->name, 'label' => $label, 'options' => $this->values, 'attributes' => $this->attributes));
}
示例2: render
/**
* Returns rendered widget.
* @param renderable $widget instance with renderable interface
* @return string
*/
public function render(renderable $widget)
{
$rendermethod = 'render_' . get_class($widget);
if (method_exists($this, $rendermethod)) {
return $this->{$rendermethod}($widget);
}
// pass to core renderer if method not found here
return $this->output->render($widget);
}
示例3: export_for_template
/**
* Export for template.
*
* @param renderer_base $output The renderer.
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
$data = new stdClass();
$attributes = $this->attributes;
if (empty($attributes['id'])) {
$attributes['id'] = html_writer::random_id('action_link');
}
$data->id = $attributes['id'];
unset($attributes['id']);
$data->disabled = !empty($attributes['disabled']);
unset($attributes['disabled']);
$data->text = $this->text instanceof renderable ? $output->render($this->text) : (string) $this->text;
$data->url = $this->url ? $this->url->out(false) : '';
$data->icon = $this->icon ? $this->icon->export_for_template($output) : null;
$data->classes = isset($attributes['class']) ? $attributes['class'] : '';
unset($attributes['class']);
$data->attributes = array_map(function($key, $value) {
return [
'name' => $key,
'value' => $value
];
}, array_keys($attributes), $attributes);
$data->actions = array_map(function($action) use ($output) {
return $action->export_for_template($output);
}, !empty($this->actions) ? $this->actions : []);
$data->hasactions = !empty($this->actions);
return $data;
}