Problem/Motivation

I want more than 3 images in my slideshow. The Appearance GUJI only lets you add 3. I am running Drupal 9.1

Steps to reproduce

I edited ~/public_html/web/themes/contrib/danland/templates/page.html.twig to add 3 more slides 4,5,6 using the same format. I have 6 slides in the images/slideshows directory prefaced by 1.name, 2.name,...6.name. This used to work.
But apparently the slide location has changed since the GUI said the names were changed to add an _ before the .jpg, and none of the files in the images/slideshows directory have the underscore in them.

Proposed resolution

How do I change the GUI to add more than 3 slides, or how do I do this manually. Where are the pictures located?

Remaining tasks

User interface changes

API changes

Data model changes

Comments

tjtj created an issue. See original summary.

tjtj’s picture

I fixed this mostly:
I also changed danland/theme-settings.php to add 3 more images, and changed the for loop to 6

function danland_settings_form_submit(&$form, FormStateInterface $form_state) {
  $account = \Drupal::currentUser();
  $values = $form_state->getValues();
  for ($i = 1; $i <= 6; $i++) {

but the additional 3 are still not displayed.

So , I finally fixed it by editing danland.theme and adding more entries like:

  $variables['slide6_url'] = theme_get_setting('slide6_url', 'danland');
  // slide6_image.
  $fid = theme_get_setting("slide6_image", "danland");
  if (!empty($fid)) {
    $file = File::load($fid[0]);
    $uri = $file->getFileUri();
    $image_path = file_create_url($uri);
  }
  else {
    $image_path = drupal_get_path('theme', 'danland') . '/images/slideshows/6.cleaning.jpg';
  }
  $variables['slide6_image'] = $image_path;

However, something is still wrong since the extra 3 slides entered in the revised theme settings should have been found by the first part of the above (uploaded to ://public)

tjtj’s picture

This stopped working at the 4th slide
Error: Call to a member function getFileUri() on null in danland_preprocess_page() (line 112 of /home/kacbtnor/public_html/web/themes/contrib/danland/danland.theme)

#0 /home/kacbtnor/public_html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): danland_preprocess_page(Array, 'page', Array)
#1 /home/kacbtnor/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render('page', Array)

bhumikavarshney’s picture

Status: Active » Needs review
StatusFileSize
new521.9 KB

Hi @tjtj,
You can take reference from this issue.
For adding more than 3 images.
https://www.drupal.org/project/danland/issues/3194625
By using the in the above you if we add 4 images or more its working fine for me
Thanks