function _jcarousel_help_backward_compatibility in jCarousel 8.4
Same name and namespace in other branches
- 8.5 jcarousel.module \_jcarousel_help_backward_compatibility()
Backward compatibility hook_help() helper.
1 call to _jcarousel_help_backward_compatibility()
- jcarousel_help in ./
jcarousel.module - Implements hook_help().
File
- ./
jcarousel.module, line 378 - Provides integration with 3rd party modules and the jCarousel library.
Code
function _jcarousel_help_backward_compatibility() {
$build = [];
$backward_details = [
'#type' => 'details',
'#title' => t('View sample code'),
'#description' => t('The following HTML may be printed out to the page through a node, block, or in a custom template. Then the following PHP code must be run to add the jCarousel library and CSS to the page.'),
];
$build[] = [
'#type' => 'html_tag',
'#tag' => 'h3',
'#value' => t('Backward compatibility'),
];
$global_usage = t('For backward compatibility in opposite to Drupal 7 implementation using jcarousel_add() you should enable jCarousel globally via <a href=":config-url">module page configuration page </a> and configure jcarousel via <a href=":attributes-url">data atributes</a>.', [
':config-url' => url::fromRoute('jcarousel.config')
->toString(),
':attributes-url' => 'https://github.com/jsor/jcarousel/blob/master/examples/data-attributes/index.html',
]);
$global_usage .= ' ' . t('Function jcarousel_add() marked as @depricated. Please use Drupal 8 render API element theme jcarousel instead and configuration via data attributes.');
$build[] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => $global_usage,
];
$images = _jcarousel_help_image_list();
$build['data_attrs_jcourusel'] = _jcarousel_help_render_gen($images);
$build['data_attrs_jcourusel_sample'] = $backward_details;
$code_html = '
<div class="jcarousel-wrapper">
<div class="jcarousel" data-jcarousel="true" data-wrap="circular">
<ul>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img1.jpg"></li>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img2.jpg"></li>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img3.jpg"></li>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img4.jpg"></li>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img5.jpg"></li>
<li><img src="http://sorgalla.com/jcarousel/examples/_shared/img/img6.jpg"></li>
</ul>
</div>
<a data-jcarousel-control="true" data-target="-=1" class="jcarousel-control-prev" href="#"></a>
<a data-jcarousel-control="true" data-target="+=1" class="jcarousel-control-next" href="#"></a>
</div>';
$build['data_attrs_jcourusel_sample']['sample'] = [
'#type' => 'inline_template',
'#template' => "<code><pre>{{ list_html|escape }} </pre></code>",
'#context' => [
'list_html' => $code_html,
],
];
return $build;
}