page.tpl.php
if (drupal_get_path_alias($_GET["q"]) == 'music/bachata_salsa') {
drupal_add_css('profiles/standard/libraries/player/jplayer/lib/circle-player/skin/circle.player.css', array('preprocess' => TRUE));
drupal_add_js('profiles/standard/libraries/player/jplayer/jquery.jplayer.min.js', array('preprocess' => TRUE));
drupal_add_js('profiles/standard/libraries/player/jplayer/lib/circle-player/js/jquery.transform2d.js', array('preprocess' => TRUE));
drupal_add_js('profiles/standard/libraries/player/jplayer/lib/circle-player/js/jquery.grab.js', array('preprocess' => TRUE));
drupal_add_js('profiles/standard/libraries/player/jplayer/lib/circle-player/js/mod.csstransforms.min.js', array('preprocess' => TRUE));
drupal_add_js('profiles/standard/libraries/player/jplayer/lib/circle-player/js/circle.player.js', array('preprocess' => TRUE));
}
{Page| Block | View} - insert inside of body (php-format, ace editor)
<style type="text/css">
.demo-container {
border: 1px solid #009BE3;
padding:0 20px;
font-family: "Myriad Pro Regular","Trebuchet MS";
}
.demo-container a, .demo-container a:link, .demo-container a:visited, .demo-container a:hover, .demo-container a:focus, .demo-container a:active {
color: #009BE3;
}
.demo-container ul {
list-style-type:none;
padding:0;
margin:1em 0;
width:100%;
overflow:hidden;
}
.demo-container ul span {
color: #A0A600;
}
.demo-container li {
float:left;
margin-right:1em;
}
.demo-container p span.track-name {
color: #CC0090;
}
@media only screen and (max-device-width : 480px) {
.volume-group {display:none;}
.demo-container .track.track-default {
font-size: 1.3rem;
}
.demo-container .track {
font-size: 1.2rem;
}
.demo-container li.audio-track {
margin-right: 0.1em;
}
.demo-container li.indention {
margin-right: 0.1em;
}
.demo-container .jp-volume-bar {
width: inherit;
height: inherit;
display: block;
}
}
</style>
<div id="jquery_jplayer"></div>
<div id="jp_container" class="demo-container b-lazy">
<ul>
<li><span>Select a track : </span></li>
- Select a track :
$node_type = "music";
$result = db_query("SELECT nid FROM node WHERE type = :nodeType ", array(':nodeType'=>$node_type));
$nids = array();
foreach ($result as $obj) {
$nids[] = $obj->nid;
}
$length = count($nids);
$keys = array_keys($nids);
shuffle($keys);
$shuffledItems = array_map(function ($key) use ($nids) {
return $nids[$key];
}, $keys);
$tags = 'field_tags';
$tag_bachata='бачата';
$tag_salsa='сальса';
//$converted_bachata = utf8_encode($tag_bachata);
//$converted_salsa = utf8_encode($tag_salsa);
for ($i = 0; $i < $length-1; $i++) {
$node[$i] = node_load($shuffledItems[$i]);
$node_tags[$i] = field_get_items('node', $node[$i], $tags);
$length_tags[$i] = count($node_tags[$i]);
for ($j = 0; $j < $length_tags[$i]; $j++) {
$term = taxonomy_term_load($node_tags[$i][$j][tid]);
$name[$i][$j] = $term->name;
}
}
for ($i = 0; $i < $length-1; $i++) {
for ($j = 0; $j < $length_tags[$i]; $j++) {
$tag_match_bachata = strcmp($tag_bachata, $name[$i][$j]);
$tag_match_salsa = strcmp($tag_salsa, $name[$i][$j]);
if ($tag_match_bachata === 0 || $tag_match_salsa === 0) {
echo '<li class="audio-track"><a href="';
$field_name = 'field_audio';
$invoked_audio[$i] = field_get_items('node', $node[$i], $field_name);
if ($format = 'url') {
print $audio_url[$i] = file_create_url($invoked_audio[$i][0]['uri']);
} else {
print $audio_url[$i] = $invoked_audio[$i][0][$format];
}
echo '"class="track">';
print $audio_title[$i] = $node[$i]->title;
echo '</a></li>';
echo '<li class="indention"> | </li>';
}
}
}
//LAST ITEM
$node[$length-1] = node_load($shuffledItems[$length-1]);
$node_tags[$length-1] = field_get_items('node', $node[$length-1], $tags);
$length_tags[$length-1] = count($node_tags[$length-1]);
for ($j = 0; $j < $length_tags[$length-1]; $j++) {
$term = taxonomy_term_load($node_tags[$length-1][$j][tid]);
$name[$length-1][$j] = $term->name;
$tag_match_bachata = strcmp($tag_bachata, $name[$length-1][$j]);
$tag_match_salsa = strcmp($tag_salsa, $name[$length-1][$j]);
if ($tag_match_bachata === 0 || $tag_match_salsa === 0) {
//last item
echo '<li class="audio-track"><a href="';
$field_name = 'field_audio';
$invoked_audio[$length-1] = field_get_items('node', $node[$length-1], $field_name);
if ($format = 'url') {
print $audio_url[$length-1] = file_create_url($invoked_audio[$length-1][0]['uri']);
} else {
print $audio_url[$length-1] = $invoked_audio[$length-1][0][$format];
}
echo '"class="track track-default">';
print $audio_title[$length-1] = $node[$length-1]->title;
echo '</a></li>';
}
}
</ul>
<p>
<span class="play-state"></span> :
<span class="track-name">nothing</span>
at <span class="extra-play-info"></span>
of <span class="jp-duration"></span>, which is
<span class="jp-current-time"></span>
</p>
<ul>
<li><a class="jp-play" href="#">Play</a></li>
<li><a class="jp-pause" href="#">Pause</a></li>
<li><a class="jp-stop" href="#">Stop</a></li>
</ul>
<ul class="volume-group">
<li>volume :</li>
<li><a class="jp-mute" href="#">Mute</a></li>
<li><a class="jp-unmute" href="#">Unmute</a></li>
<li> <a class="jp-volume-bar" href="#">|<---------->|</a></li>
<li><a class="jp-volume-max" href="#">Max</a></li>
</ul>
</div>
:
nothing
at
of , which is
- volume :
- Mute
- Unmute
- |<---------->|
- Max
<script type="text/javascript">
$(document).ready(function(){
// Local copy of jQuery selectors, for performance.
var my_jPlayer = $("#jquery_jplayer"),
my_trackName = $("#jp_container .track-name"),
my_playState = $("#jp_container .play-state"),
my_extraPlayInfo = $("#jp_container .extra-play-info");
// Some options
var opt_play_first = false, // If true, will attempt to auto-play the default track on page loads. No effect on mobile devices, like iOS.
opt_auto_play = true, // If true, when a track is selected, it will auto-play.
opt_text_playing = "Now playing", // Text when playing
opt_text_selected = "Track selected"; // Text when not playing
// A flag to capture the first track
var first_track = true;
// Change the time format
$.jPlayer.timeFormat.padMin = false;
$.jPlayer.timeFormat.padSec = false;
$.jPlayer.timeFormat.sepMin = " min ";
$.jPlayer.timeFormat.sepSec = " sec";
// Initialize the play state text
my_playState.text(opt_text_selected);
// Instance jPlayer
my_jPlayer.jPlayer({
ready: function () {
$("#jp_container .track-default").click();
},
timeupdate: function(event) {
my_extraPlayInfo.text(parseInt(event.jPlayer.status.currentPercentAbsolute, 10) + "%");
},
play: function(event) {
my_playState.text(opt_text_playing);
},
pause: function(event) {
my_playState.text(opt_text_selected);
},
ended: function(event) {
my_playState.text(opt_text_selected);
},
swfPath: "/profiles/standard/libraries/player/jplayer",
cssSelectorAncestor: "#jp_container",
supplied: "mp3",
wmode: "window"
});
// Create click handlers for the different tracks
$("#jp_container .track").click(function(e) {
my_trackName.text($(this).text());
my_jPlayer.jPlayer("setMedia", {
mp3: $(this).attr("href")
});
if((opt_play_first && first_track) || (opt_auto_play && !first_track)) {
my_jPlayer.jPlayer("play");
}
first_track = false;
$(this).blur();
return false;
});
});
</script>
The result can be seen here... 😊😊😊
@jpcwebb, wow, it is perfect!
you absolutely recognizably do make a british correct way to compose a sentence (=)^(=)
... amazing!
@ressa, definitely, i support you, it must have been fixed
- Install ISP Config control panel;
- Add your additional php version for your needs;
- Install compatible to your php versions composers.
If your consider that that my step-by-step guide useless, then i give up.
D10 doesn't have some of needed modules, which exist in D9; e.g., we_megamenu, php-filter
I think, v10 is still raw.
Take a look how frequently it is updated:
- 10.1.0-rc1 → - 9 June 2023
- 10.1.0-beta1 → - 15 May 2023
- 10.0.9 → - 3 May 2023
- 10.1.0-alpha1 → - 29 April 2023
- 10.0.8 → - 20 April 2023
- 10.0.7 → - 25 March 2023
- 10.0.6 → - 24 March 2023
- 10.0.5 → - 16 March 2023
- 10.0.4 → - 2 March 2023
- 10.0.3 → - 2 February 2023
- 10.0.2 → - 19 January 2023
- 10.0.1 → - 5 January 2023
My question, Sir: - do you promote here your website or really need some help?
about php versions allowed to drupal 8: you have pointed out v 8.5.15, but mine was 8.9.20.
9 is higher than 5, right ㋛?
Your version of D8 has this restriction' values:
if (version_compare(PHP_VERSION, '5.5.9') < 0) {
print 'Your PHP installation is too old. Drupal requires at least PHP 5.5.9. See the <a href="https://www.drupal.org/requirements">system requirements</a> page for more information.';
exit;
}
I can only run Composer ^1.x, which is also enjoyable.
To be able to use newer versions of the Composer just keep in mind that they are compatible with higher php-versions.
Feel free to use my guide how to enable multiple composers + multiple php - https://www.drupal.org/forum/support/installing-drupal/2023-03-17/instal... →
Initially, try, then ask what was not clear, what difficulties have arisen.
Bit confused of your crumpled description.
Guide for upgrading to what?
Unfortunately, a plain core search "drupal 8 requirements" within the drupal website returns empty query.
PHP requirements for Drupal 7 →
PHP requirements for Drupal 8 - ChatGPT modelled response (drupal 8 requirements php):
Drupal 8 requires PHP version 7.3 or higher. It is recommended to use the latest stable version of PHP for better performance and security. Additionally, Drupal 8 requires some PHP extensions to be installed, such as:
- PDO (PHP Data Objects)
- MySQL or PostgreSQL database drivers for PDO
- JSON
- XML
- MBstring (Multibyte String)
- SimpleXML
- Zip
- GD (Graphics Draw)
drupal_8_9_20/core/install.php
// Exit early if running an incompatible PHP version to avoid fatal errors.
// The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not
// yet available. It is defined in bootstrap.inc, but it is not possible to
// load that file yet as it would cause a fatal error on older versions of PHP.
if (version_compare(PHP_VERSION, '7.0.8') < 0) {
print 'Your PHP installation is too old. Drupal requires at least PHP 7.0.8. See the <a href="https://www.drupal.org/requirements">system requirements</a> page for more information.';
exit;
}
elseif (version_compare(PHP_VERSION, '8.0', '>=')) {
print 'Update to the latest release of Drupal 9 for improved PHP 8 support, or use PHP 7.4. See the <a href="https://www.drupal.org/requirements">system requirements</a> page for more information.';
exit;
}
do I need to be at least PHP 7+ to upgrade further
use your server with multiple php versions always - for comfortable development (ISP Config helps much to simplify handling).
Drupal 8 end-of-life on November 2, 2021 → - my choice is still D7, i recommend to downgrade to that one.
How to upgrade from Drupal 8 to Drupal 9 →
PHP versions → supported
Just thank you for your hint with the themes section!
$md = \Drupal::service('mobile_detect');
$is_mobile = $md->isMobile();
Nope, that one fragment was useless in the case. I already tried it.
I wrote to you that maybe you are using the wrong template, you need to use the one that is placed in your theme.
You are right, i was using the template from the module - web/core/modules/forum/templates/forum-list.html.twig.
Despite of i was angry upon you, but have checked again this your latter text.
And i have noticed that the theme, really, has its own forum template: web/themes/contrib/bfd/templates/content/forum/forum-list.html.twig.
Namely for this case it has helped. Thank you!
But there is still an unsolved situation when is_mobile() - Mobile Detect should be rendered directly inside of a module + no specific template inside of theme.
- Yes, it works
either
- No, smth. is wrong with module
- can't be acknowledged as a "sharing result".
What for have i placed info about your behaviour? - to let other members know what to expect from you.
I hope, we are done with this sort of conversation.
I do not intend to use this venue as a Champion' fighting arena.
You could also check my latest comments, finding that i freely share what i know.
This dude could just paste a snippet how it was working for him and it would have been fine, but he decided maintain my interest posting it publicly that everything is okay with the module and privately - that he can fix it to me for some rate.
Next time just be in my place, explain your issue, post the header "Hope for your support" and receive privately as it would be looking like you entitled: "I will pay for your support".
I believe this behaviour doesn't meet Values of the Drupal.
You may have not noticed that @gisle already mentioned, that this discussion appears to include escalating emotions.
If you have nothing to say about the issue itself, just ignore this topic, right?
Today you have written personally (via contact form):
Hello Alex,
if you want, I can work on mobile detect issue for 60$.
Man, it is disgusting
Although my aim is to add properly menu images, it would be extremely useful to get to know how compose view tree of menu items themselves.
How do i render images-field of menu items in Drupal 7?
Let us assume that we have both Bootstrap 3 → sub-theme and menuimage → module enabled.
Next we must declare our menu image in our theme: (/themes/bootstrap_subtheme/template.php)
function bootstrap_subtheme_menu_link($variables) {
$element = $variables['element'];
$sub_menu = '';
$options = !empty($element['#localized_options']) ? $element['#localized_options'] : array();
// Check plain title if "html" is not set, otherwise, filter for XSS attacks.
$title = empty($options['html']) ? check_plain($element['#title']) : filter_xss_admin($element['#title']);
// Ensure "html" is now enabled so l() doesn't double encode. This is now
// safe to do since both check_plain() and filter_xss_admin() encode HTML
// entities. See: https://www.drupal.org/node/2854978
$options['html'] = TRUE;
$href = $element['#href'];
$attributes = !empty($element['#attributes']) ? $element['#attributes'] : array();
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
$sub_menu = drupal_render($element['#below']);
}
elseif ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] == 1)) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
$title .= ' <span class="caret"></span>';
$attributes['class'][] = 'dropdown';
$options['attributes']['class'][] = 'dropdown-toggle';
$options['attributes']['data-toggle'] = 'dropdown';
}
}
require_once 'sites/all/libraries/Mobile_Detect/Mobile_Detect.php';
$detect = mobile_detect_get_object();
$is_tablet = $detect->isTablet();
$is_mobile = $detect->isMobile();
if(isset($element['#localized_options']['content']) && isset($element['#localized_options']['content']['image'])){
$fid = $element['#localized_options']['content']['image'];
$image = file_load($fid);
$image_uri = $image->uri;
$image = file_create_url($image->uri);
if (!$is_mobile) {
$menu_image = $element['#image'] = '<div align="center" class="on_top_image"><img alt = "' . $element['#title'] . '" title = "' . $element['#title'] . '" src="'. image_style_url('menu_image',$image_uri) .'" /></div>';
}
elseif ($is_mobile) {
$menu_image = $element['#image'] = '<img alt = "' . $element['#title'] . '" title = "' . $element['#title'] . '" src="'. image_style_url('menu_image',$image_uri) .'" />';
}
$title = $menu_image . $title;
}
return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . $sub_menu . "</li>\n";
}
And assign some css-styles to make menu items looking better:
- /themes/bootstrap_subtheme/css/mobile_menu.css.less
.dropdown-menu .on_top_image { padding-right: 4px; } ul.dropdown-menu li a { div { display: inline; } &.fa::before { padding-right: 2px; } } .menu.nav.navbar-nav li a { text-align: center; img { /*display: block;*/ width: 54px; height: 54px; } } #page-header .lead { padding-top: 4.5rem; } .name.navbar-brand { font-size: 2em; padding-top: 1em; }
- /themes/bootstrap_subtheme/css/menu.css.less
.menu.nav.navbar-nav li a { padding-left:10px; img { display: inline; width: 45px; height: 45px; padding-right:3px; } } ul.dropdown-menu a.fa::before { padding-right: 2px; }
- /themes/bootstrap_subtheme/template.php
// Mobile detection require_once 'sites/all/libraries/Mobile_Detect/Mobile_Detect.php'; $detect = mobile_detect_get_object(); $is_tablet = $detect->isTablet(); $is_mobile = $detect->isMobile(); if (!$is_mobile) { drupal_add_css(drupal_get_path('theme', 'bootstrap_subtheme') . '/css/menu.css.less', array('preprocess' => TRUE)); } elseif ($is_mobile) { drupal_add_css(drupal_get_path('theme', 'bootstrap_subtheme') . '/css/mobile_menu.css.less', array('preprocess' => TRUE)); } // end of notMobile detect }
I have also stuck with the same matter.
Drupal 9 has serious deficiency in building menu items with images.
Have no idea how to implement hierarchical structure
Hi @eleonel!
I have updated both the module and sub-module:
- php81 /usr/local/bin/composer81 require 'drupal/augmentor_chatgpt:1.0.x-dev@dev'
- php81 /usr/local/bin/composer81 require 'drupal/augmentor:^1.0'
Upgrading drupal/augmentor_chatgpt (1.0.0-alpha1 => dev-1.0.x 39eef82)
Upgrading drupal/augmentor (1.0.1 => 1.0.4): Extracting archive
But
"field_token_value_text" plugin does not exist.
has not disappeared.
Dear @arturopanetta, after pushing transcode task, it has given a full load to my server
and then has gone away with "503"
Does it behave the same way for you or anyone else?
#17, @Bhanu951, i bit disagree, because preliminary had uninstalled module and only after that reinstalled with the changes already made.
And the try was unsuccessful until executing drush.
Probably, the module itself doesn't clean properly while the uninstall procedure.
Thanks for your explanation, Bhanu!
@Bhanu951, you were right, Sir, it does depend on..!
In my case, i am able to launch as:
php81 ./vendor/bin/drush cim --partial --source=/var/www/websites/client0/domain1/drupal9-edition/web/modules/contrib/streaming/modules/streaming_media_views/config/optional/
+------------+--------------------------------------------------------------+-----------+
| Collection | Config | Operation |
+------------+--------------------------------------------------------------+-----------+
| | field.storage.media.field_poster | Create |
| | field.storage.media.field_playlist | Create |
| | media.type.streaming_video | Create |
| | field.field.media.streaming_video.field_poster | Create |
| | field.field.media.streaming_video.field_playlist | Create |
| | field.field.media.streaming_video.field_media_video_file | Create |
| | core.entity_view_display.media.streaming_video.default | Create |
| | core.entity_view_display.media.streaming_video.media_library | Create |
| | core.entity_form_display.media.streaming_video.media_library | Create |
| | core.entity_form_display.media.streaming_video.default | Create |
| | field.storage.media.field_media_video_file | Update |
+------------+--------------------------------------------------------------+-----------+
Import the listed configuration changes? (yes/no) [yes]:
>
[error] Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Configuration <em class="placeholder">editor.editor.php_code</em> depends on the <em class="placeholder">filter.format.php_code</em> configuration that will not exist after import. in Drupal\Core\Config\ConfigImporter->validate() (line 788 of /var/www/websites/client0/domain1/drupal9-edition/web/core/lib/Drupal/Core/Config/ConfigImporter.php).
In ConfigImportCommands.php line 324:
The import failed due to the following reasons:
Configuration <em class="placeholder">editor.editor.php_code</em> depends on the <em class="pla
ceholder">filter.format.php_code</em> configuration that will not exist after import.
Although there is some error yet (even with php-filter disabled), but now no more obstacles for the module to work.
Thank you!
For such an occasion, could you explain to me why we need to run this drush string if we have already patched the module?
#13
my server' root doesn't really matter, i was running it properly from the root of the website
(honestly, i am not familiar much with the drush tool)
i am not assured about running this after the patch:
drush cim --partial --source=web/modules/contrib/streaming/modules/streaming_media_views/config/optional/
[error] The source directory does not exist. The source is not a directory.
But #9 has not worked for me:
admin/structure/media/manage/streaming_video/form-display
Still i have this:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\file\Plugin\Field\FieldWidget\FileWidget::__construct(): Argument #5 ($third_party_settings) must be of type array, null given, called in /var/www/websites/client0/domain1/drupal9-edition/web/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php on line 49 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->__construct() (line 40 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
........................................................
(as for me) dear @eleonel, i will try it within next 24 hours.
Sure, Sir (@bharath-kondeti),
this is -
https://www.drupal.org/project/video/issues/3314510
🐛
Entity type 'Drupal\video_transcode\Entity\Preset' is missing 'config_export' definition in its annotation
RTBC
- what i meant by saying "The guys were correct about the solution for..."
modules/contrib/video/modules/video_transcode/src/Entity/Preset.php
By the way, if you could notice,
with the $config['system.logging']['error_level'] = 'verbose';
enabled, the error still persists
Warning: Undefined variable $destination in Drupal\video_transcode\Form\PresetFormBase->buildForm() (line 382 of modules/contrib/video/modules/video_transcode/src/Form/PresetFormBase.php).
Drupal\video_transcode\Form\PresetFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Warning: Undefined variable $destination in Drupal\video_transcode\Form\PresetFormBase->buildForm() (line 384 of modules/contrib/video/modules/video_transcode/src/Form/PresetFormBase.php).
Drupal\video_transcode\Form\PresetFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
It means, we just have to declare that variable $destination correctly.
For Drupal 7 the destination was declared that way (/video/modules/video_ui/video.preset.inc):
// When the scheme is private, Zencoder can't download the file.
// Force the scheme to public in this case.
$destination = (file_default_scheme() != 'private' ? file_default_scheme() : 'public') . '://videos/watermark';
file_default_scheme - (/includes/file.inc):
function file_default_scheme() {
return variable_get('file_default_scheme', 'public');
}
@mr_scumbag, cool! it seems, you are extremely skillful.
i believe, you can cope with that.
by the way, maybe, if you are fond of, i can share, how i directly embed streaming to a website.
definitely, i always disable conflicted modules: for drupal 7 it was a wearisome procedure to build a stable core of required for my needs modules.
if you do not mind, share through the private message what your stable core (of modules) looks like for D7 & D9.
(it can be composed via Views)
Sorry, i have tried one more time...
This is an output:
<div class="field field--name-field-media-document field--type-file field--label-above">
<div class="field__label">Document</div>
<div class="field__item"><iframe class="pdf" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" src="/libraries/pdf.js/web/viewer.html?file=http%3A%2F%2F<domain.name>%2FPALS%2Fmedia%2Fdocument%2F2023-04%2FEng%2520article.pdf#page=1&zoom=auto&pagemode=thumbs" data-src="http://<domain.name>/PALS/media/document/2023-04/Eng%20article.pdf" title="Eng article.pdf" width="100%" height="400px" frameborder="no"></iframe>
</div>
</div>
This is - how it works for Embedded Google Document Viewer module, an output:
<div class="field field--name-field-media-document field--type-file field--label-above">
<div class="field__label">Document</div>
<div class="field__item"><iframe class="gdoc-field" src="https://docs.google.com/gview?embedded=true&url=http://d9.dambo.me/PALS/media/document/2023-04/Eng%20article.pdf"></iframe>
<div class="gdoc-filename"><a href="http://d9.dambo.me/PALS/media/document/2023-04/Eng%20article.pdf">Eng article.pdf</a></div>
</div>
</div>
I tried to determine, where or not it is smth. wrong with the downloaded library:
<script src="/libraries/pdf.js/build/pdf.js"></script>
<style type="text/css">
#the-canvas {
border: 1px solid black;
direction: ltr;
}
</style>
<div>
<button id="prev">Previous</button>
<button id="next">Next</button>
<span>Page: <span id="page_num"></span> / <span id="page_count"></span></span>
</div>
<canvas id="the-canvas"></canvas>
<script type="text/javascript">
// If absolute URL from the remote server is provided, configure the CORS
// header on that server.
var url = 'http://<domain_name>/PALS/media/document/2023-04/Eng%20article.pdf';
// Loaded via <script> tag, create shortcut to access PDF.js exports.
var pdfjsLib = window['pdfjs-dist/build/pdf'];
// The workerSrc property shall be specified.
pdfjsLib.GlobalWorkerOptions.workerSrc = '/libraries/pdf.js/build/pdf.worker.js';
var pdfDoc = null,
pageNum = 1,
pageRendering = false,
pageNumPending = null,
scale = 0.8,
canvas = document.getElementById('the-canvas'),
ctx = canvas.getContext('2d');
/**
* Get page info from document, resize canvas accordingly, and render page.
* @param num Page number.
*/
function renderPage(num) {
pageRendering = true;
// Using promise to fetch the page
pdfDoc.getPage(num).then(function(page) {
var viewport = page.getViewport({scale: scale});
canvas.height = viewport.height;
canvas.width = viewport.width;
// Render PDF page into canvas context
var renderContext = {
canvasContext: ctx,
viewport: viewport
};
var renderTask = page.render(renderContext);
// Wait for rendering to finish
renderTask.promise.then(function() {
pageRendering = false;
if (pageNumPending !== null) {
// New page rendering is pending
renderPage(pageNumPending);
pageNumPending = null;
}
});
});
// Update page counters
document.getElementById('page_num').textContent = num;
}
/**
* If another page rendering in progress, waits until the rendering is
* finised. Otherwise, executes rendering immediately.
*/
function queueRenderPage(num) {
if (pageRendering) {
pageNumPending = num;
} else {
renderPage(num);
}
}
/**
* Displays previous page.
*/
function onPrevPage() {
if (pageNum <= 1) {
return;
}
pageNum--;
queueRenderPage(pageNum);
}
document.getElementById('prev').addEventListener('click', onPrevPage);
/**
* Displays next page.
*/
function onNextPage() {
if (pageNum >= pdfDoc.numPages) {
return;
}
pageNum++;
queueRenderPage(pageNum);
}
document.getElementById('next').addEventListener('click', onNextPage);
/**
* Asynchronously downloads PDF.
*/
pdfjsLib.getDocument(url).promise.then(function(pdfDoc_) {
pdfDoc = pdfDoc_;
document.getElementById('page_count').textContent = pdfDoc.numPages;
// Initial/first page rendering
renderPage(pageNum);
});
</script>
When i set up as:
pdfjsLib.GlobalWorkerOptions.workerSrc = '/libraries/pdf.js/build/pdf.worker.js';
;<script src="/libraries/pdf.js/build/pdf.js"></script>
,
it didn't work.
When i placed remote sources:
<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
;pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
,
it was showed properly.
Now i have also tested for D7.
Confirm, it's fine
Right, i have checked also for some other D9 website.
PDF reader was rendered correctly.
Seems, some my enabled modules collide with drupal/pdf:^1.1.
To Drupal it always happens.
Damned it, 've just wasted a lot of time.
First of all, this is my fault; i have downloaded the library this way:
cd web/libraries; git clone https://github.com/mozilla/pdf.js.git;
and even did not install all dependencies for PDF.js:
$ npm install
After using stable release - https://github.com/mozilla/pdf.js/releases/download/v3.5.141/pdfjs-3.5.1... - from there, there is the build inside:
pdf.js pdf.js.map pdf.sandbox.js pdf.sandbox.js.map pdf.worker.js pdf.worker.js.map
Which advantages has it given to us?
Still, the main option - PDF: Default viewer of PDF.js - provides no correct output, with a missed source:
But it has begun to compose a desired page for PDF: Display the first page, placed !upside-down.
@shailja179, okay, i was using Paragraphs.
To simplify, the steps are:
- php81 /usr/local/bin/composer81 require 'drupal/pdf:^1.1'
- /admin/structure/types/manage/article/fields/add-field
- /admin/structure/types/manage/article/display
cd web/libraries
wget https://github.com/mozilla/pdf.js/releases/download/v3.5.141/pdfjs-3.5.1...
unzip pdfjs-3.5.141-legacy-dist.zip -d pdf.js
Reference -> File
"PDF: Default viewer of PDF.js"
To verify, whether it depends on the pdf.js library, we can install require 'drupal/pdf_reader:^1.0' and enable pdf.js as a view output.
The library works, but companied with continuous blinking and of entire pdf-document pages height.
D9 php 8.1
same matter for me without distinction of 'drupal/streaming:^1.1' or 'drupal/streaming:^1.2':
TypeError: Drupal\file\Plugin\Field\FieldWidget\FileWidget::__construct(): Argument #5
....................................................
..............................
Warning: Undefined array key "third_party_settings" in Drupal\file\Plugin\Field\FieldWidget\FileWidget::create() (line 49 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
hence, it is the same wherever the streaming widget is being invoked:
- /media/add/streaming_video
- /admin/structure/media/manage/streaming_video/fields/media.streaming_video.field_playlist
But the idea was good; worthy of praise.
@fishfree, enable CKEditor 4 altogether with ChatGPT Augmentor and/or OpenAI GPT3 Augmentor.
Then create your augmentors (/admin/config/augmentors):
ChatGPT Augmentor, which uses gpt-3.5-turbo model, is more stable.
In case of ADA, my configuration is:
- Temp: 0.2
- Max tokens: 186
- Frequency Penalty: 0.6
- Presence Penalty: 0.3
Would be nice to hear your configuration set, and have you tried to drill your model (ada, curie, babbage)
@ressa, i was inspired by your idea to suggest something which could make the drupal website looking better.
My suggestion:
dashboard badge - counter of watched topics and etc.
allexim → created an issue.
An error still persists for the field entities, even though i tried to switch a Display widget:
- Augmentor Default Widget
- Augmentor
- Augmentor File Widget
- was tested for D9 with php 8.1
its behaviour:
input:
ckeditor4 text editor
output:
- Augmentor Default Widget
undefined
I'm sorry, I cannot answer your question without knowing what it is. Please provide more information.
I'm sorry, I cannot answer your question without knowing what it is. Please provide more information.
- Augmentor
no action at all
The guys were correct about the solution for:
- Transcoder preset;
- Upload widget,
but the issue with the embed field (after saving) still persists.
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Drupal\video\Plugin\Field\FieldWidget\VideoEmbedWidget->extractFormValues() (Line: 237)
Sure, i will open a new issue...
Yes, i've read them both:
https://git.drupalcode.org/project/computed_field/-/blob/4.0.x/README.md
https://git.drupalcode.org/project/computed_field/-/blob/3.x/README.md
Will try to read again more attentively.
Same thing did happen to me:
Error message
There was a problem creating field augmented field: The "field_token_value_text" plugin does not exist.
-
Bare integration to CKEditor 4
- Add a new Augmentor field
- with OpenAI GPT3 Augmentor enabled:
the DISPARATE result - an empty set of augmentors.
After enabling an additional module Demo Augmentor and creating a key with: {key type - authentication, key provider - configuration, key value - anything},
upon highlighting of a fragment of a text it just duplicates an original one to the string below
Beforehand an augmentor type must be added: /admin/config/augmentors
(/admin/structure/types/manage/.../fields/add-field) in this case, only an error emerges.
Neither a tab nor something else is visible in the node create template.
- when trying to edit newly created OpenAI GPT3 Completion
Error: Class "Orhanerday\OpenAi\OpenAi" not found in Drupal\augmentor_openai_gpt3\OpenAiGPT3Base->getClient() (line 36 of modules/contrib/augmentor_openai_gpt3/src/OpenAiGPT3Base.php).
Drupal\augmentor_openai_gpt3\OpenAiGPT3Base->getClient() (Line: 285)
Drupal\augmentor_openai_gpt3\Plugin\Augmentor\OpenAiGPT3Completions->engines() (Line: 61)
Drupal\augmentor_openai_gpt3\Plugin\Augmentor\OpenAiGPT3Completions->buildConfigurationForm() (Line: 112)
Drupal\augmentor\Form\AugmentorFormBase->buildForm() (Line: 18)
Drupal\augmentor\Form\AugmentorEditForm->buildForm()
call_user_func_array() (Line: 534)
an error is thrown:
Error during the completion execution, please check the logs for more information.
P.S.: I have written this to support the reporter.
Thank you for your quick reply!
... about v4:
php82 /usr/local/bin/composer82 require 'drupal/computed_field:^4.0@alpha'
/admin/structure/types/manage/video/fields
- upon verbose error level enabled ($config['system.logging']['error_level'] = 'verbose';)
<em>Error message</em>
Deprecated function: Creation of dynamic property Drupal\computed_field\Form\ComputedFieldForm::$pluginManager is deprecated in Drupal\computed_field\Form\ComputedFieldForm->configureEntityViewDisplay() (line 300 of modules/contrib/computed_field/src/Form/ComputedFieldForm.php).
Drupal\computed_field\Form\ComputedFieldForm->configureEntityViewDisplay('computed_php') (Line: 250)
Drupal\computed_field\Form\ComputedFieldForm->submitForm(Array, Object)
Drupal\computed_field\Form\ComputedFieldForm->configureEntityViewDisplay('computed_php') (Line: 250)
Drupal\computed_field\Form\ComputedFieldForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Computed value source:
(the only one option) Reverse entity reference
Entity reference field:
Entity ID on Comment entities
/admin/structure/types/manage/video/display
- All, what i see, is just a possibility to switch format:
- rendered entity
- entity id
- label
As for me, i do not have deep programming skills.
My experience of D7 computed field doesn't allow to comprehend your module for the latest versions of Drupal - D{9,10}, it is really hard to figure out how to deal with.
and a some unwanted behaviour:
- after having saved/added a new menu item, it redirects you to the front page.
Yep, right!
I agree! Like creating a complicated Rule, when preliminary enabled role transits to the Approved one.
(=)^(=) lot of fun!
I was enjoying reading it (according to above written)
I do get notifications for all my issues, both email and on my tracking page, so everything works well for me.
for some reason, i do not receive.
Last time i have gotten it, was for: [Forum topic] View video files with Video JS, 2023-04-12.
Checked one more time: all my notifications' settings are On.
I actually think administrators such as @gisle does an amazing job in the forums, just as @drumm does a great job keeping drupal.org well functioning, and for example updated the drupal.org breadcrumbs shortly after I made the suggestion: #3347456: Smaller breadcrumbs.
Fine, they are ready to adjust css a bit.
Seems, the drupal system and its owners had become more distant to... everything, do they?
i also do not get any notifications about updates specifically to this topic.
@ressa, why did you use the unborn metaphor?
Has the time for changes come?
Definitely, they were left as a draft for ever.
Yep, the drupal is built to use many tricks.
Why not just to talk with the administrators of the drupal.org website and ask them to allow remote src for images and to change the configuration of the text editor?
And, @ressa, as you could have noticed, all rest images were also wiped out.
I invoke again the admins of the Drupal and claim to enable support of the images' upload, pleeazzzzzz!!!
I left them as a draft/unsaved and assigned here.
(replied to you in different forum thread)
Dear dru-pals,
7 hours ago i had uploaded some images through/add/casestudy.
When had posted a forum topic → , all of them were visible.
A little later some of images vanished.
I invoke drupal pundits!!! woooooo
Composer is also failed to install with:
<strong>php82 /usr/local/bin/composer82 require 'drupal/views_data_export:^1.3'</strong>
Problem 1
- drupal/csv_serialization 1.4.0 requires drupal/core ^8.0.4 -> found drupal/core[8.0.4, ..., 8.9.20] but the package is fixed to 10.0.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- drupal/csv_serialization 1.5.0 requires drupal/core ^8.7.12 || ^9.0 -> found drupal/core[8.7.12, ..., 8.9.20, 9.0.0, ..., 9.5.7] but the package is fixed to 10.0.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- drupal/csv_serialization[2.0.0, ..., 2.1.0] require drupal/core ^8 || ^9 -> found drupal/core[8.0.0, ..., 8.9.20, 9.0.0, ..., 9.5.7] but the package is fixed to 10.0.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- drupal/views_data_export 1.3.0 requires drupal/csv_serialization ~1.4 || ~2.0 || ~3 -> satisfiable by drupal/csv_serialization[1.4.0, 1.5.0, 2.0.0, 2.1.0].
- Root composer.json requires drupal/views_data_export ^1.3 -> satisfiable by drupal/views_data_export[1.3.0].
Only plain longstanding and reliable method < wget https://ftp.drupal.org/files/projects/views_data_export-8.x-1.3.tar.gz> allows to run it after this:
php82 /usr/local/bin/composer82 require 'drupal/csv_serialization:^3.0@RC'
Alas, but i was unable to figure out of a usage of drush: drush views-data-export [view-name] [display-id] [output-file]
.
My View
[view-name]
http://web.site/admin/structure/views/view/eva_video
[display-id]
http://web.site/admin/structure/views/view/eva_video/edit/entity_view_1
[output-file]
eva_video.xml
Input command: (from root) php82 ./vendor/bin/drush views-data-export eva_video entity_view_1 eva_video.xml
Normal front-end execution for Views-view is also vague - no expected result to export the whole view.
Cool! Thank you...
After following these steps, it has solved the issue:
- php82 /usr/local/bin/composer82 config repositories.assets composer https://asset-packagist.org
- php82 /usr/local/bin/composer82 config --json extra.installer-types '["npm-asset", "bower-asset"]'
- php82 /usr/local/bin/composer82 config --json extra.installer-paths.web\/libraries\/ace '["npm-asset/ace-builds"]'
- php82 /usr/local/bin/composer82 config --unset extra.installer-paths.web\/libraries\/\{\$name\}
- php82 /usr/local/bin/composer82 config --json extra.installer-paths.web\/libraries\/\{\$name\} '["type:drupal-library", "type:bower-asset", "type:npm-asset"]'
php82 /usr/local/bin/composer82 require drupal/ace_editor:2.0.x-dev
Do you trust "oomphinc/composer-installers-extender" to execute code and wish to enable it now?
Perfect!
I confirm, now it works.
Your quick replies are appreciated!
Even an attempt to remove the Video Transcode module ends with the failure:
Error: Call to undefined function drupal_uninstall_schema() in video_transcode_uninstall() (line 114 of modules/contrib/video/modules/video_transcode/video_transcode.install).
call_user_func_array() (Line: 400)
Drupal\Core\Extension\ModuleHandler->invoke() (Line: 459)
Drupal\Core\Extension\ModuleInstaller->uninstall() (Line: 91)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall() (Line: 174)
Drupal\system\Form\ModulesUninstallConfirmForm->submitForm()
call_user_func_array() (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 595)
Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 686)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Hi there,
i have recently added the step-by-step guide on how to allocate new drupal 10 website using composer.
But there is still some issue that persists:
- having been installed through the composer, website has some intermediate path:
the root, where main composer.json resides, is followed by an additional directory /web
Thus, server-side configuration for website must be applied:
(Apache server)
<Directory /var/www/drupal.website>
</Directory>
<VirtualHost *:80>
RewriteCond %{REQUEST_URI} !^/web/
RewriteRule ^/(.*)$ /web/$1 [L]
</VirtualHost>
After enabling the rewrite rule, an error appears:
Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.
Hope, somebody could suggest how to solve...
unfortunately, no idea what to add there (/core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php):
/**
* A list of trusted URLs, which are safe to redirect to.
*
* @var string[]
*/
protected $trustedUrls = [];
This method is incorrect:
https://www.drupal.org/forum/support/installing-drupal/2023-01-06/drupal... →