As discussed here #2213757: Should transliteration be a part of Panopoly SEO transliteration should probably be part of panopoly-core as it adds some sanity to e.g. file names.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

caschbre’s picture

Great idea! It's a module I include on every site I build.

caschbre’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
FileSize
802 bytes

After installing it locally I didn't see any configuration / exports that needed to be changed. So adding it to panopoly_core .info/.make files.

caschbre’s picture

Status: Active » Needs review
mrfelton’s picture

Status: Needs review » Needs work

If we are considering this a standard module now, I think this should be enabled automatically for existing sites in the upgrade process.

caschbre’s picture

Status: Needs work » Needs review
FileSize
1.23 KB

Yep!

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Upgraded just fine! Rebuilt a-okay, too.

  • mrfelton committed 402819c on 7.x-1.x
    Update Panopoly Core for #2213769 by caschbre | lsolesen: Added...
mrfelton’s picture

Status: Reviewed & tested by the community » Fixed
miromarchi’s picture

Hi, thanks for the job here.
As a panopoly base distribution user, I wish to share my experience after upgrading to panopoly1.8 with transliteration module included. This is a sort of log.

  • I updated to latest panopoly version with a custom make file drush make panopoly1.8.make. Makefile content:
    api = 2
    core = 7.x
    
    ; upgrade to panopoly 1.8 and core 7.30
    
    projects[drupal][version] = 7.30
    ; Patch sssue "String offset cast notice in field_invoke_method_multiple()" - let's try patch 2 which is to be RTBC
    projects[drupal][patch][1824820] = https://www.drupal.org/files/string-offset-cast-1824820-2.patch
    
    ; The Panopoly Foundation update 7.x-1.8
    projects[panopoly_core][version] = 1.8
    projects[panopoly_core][subdir] = panopoly
    projects[panopoly_images][version] = 1.8
    projects[panopoly_images][subdir] = panopoly
    projects[panopoly_theme][version] = 1.8
    projects[panopoly_theme][subdir] = panopoly
    projects[panopoly_magic][version] = 1.8
    projects[panopoly_magic][subdir] = panopoly
    projects[panopoly_widgets][version] = 1.8
    projects[panopoly_widgets][subdir] = panopoly
    projects[panopoly_admin][version] = 1.8
    projects[panopoly_admin][subdir] = panopoly
    projects[panopoly_users][version] = 1.8
    projects[panopoly_users][subdir] = panopoly
    
    ; The Panopoly Toolset update 7.x-1.8
    projects[panopoly_pages][version] = 1.8
    projects[panopoly_pages][subdir] = panopoly
    projects[panopoly_wysiwyg][version] = 1.8
    projects[panopoly_wysiwyg][subdir] = panopoly
    projects[panopoly_search][version] = 1.8
    projects[panopoly_search][subdir] = panopoly
    
  • I then visit admin/reports/status and I see I have pending database updates and I need to run the update script (update.php).
    Pending updates are:

    media module:
    7226 - Accommodate the introduction of a new permission which restricts access to the media browser by granting it to existing users who were able to access it.
    panopoly_core module:
    7003 - Remove the 'node_body' Pane from the list of allowed panes.
    7100 - Enable the transliteration module..

  • I run updates.
    I got these log messges:
    info      system  transliteration module installed.                                                                                             
    info      system  transliteration module enabled.
    

    Then I got the message:
    Transliteration has been installed. <em>Fix existing file names</em>. Which links to admin/config/media/file-system/transliteration.

  • Visiting that page transliteration module shows me a list of file names containing non-ASCII characters and their proposed renaming.
    The page also shows the warning:

    WARNING: if you have manually entered image or file paths in text fields (for example, text areas or WYSIWYG editors), renaming the files will break these references. Since there is currently no automated way to also fix referenced files in textual contents, it is a very good idea to backup the database and /sites/default/files directory beforehand. Modules accessing files using their internal system ids are not affected.

  • I hit Transliterate.
    I have this success message:

    34 file names have been successfully transliterated.

    and also 135 notices:

    notice php Notice: Undefined property: stdClass::$metadata in file_entity_file_update() (line 120 of /sites/all/modules/contrib/file_entity/file_entity.file.inc).

  • Affected section of file_entity.file.inc is:
      // Save file metadata.
      db_delete('file_metadata')->condition('fid', $file->fid);
      if (!empty($file->metadata)) {
        foreach ($file->metadata as $name => $value) {
          db_merge('file_metadata')
            ->fields(array(
              'value' => serialize($value),
            ))
            ->key(array(
              'fid' => $file->fid,
              'name' => $name,
            ))
            ->execute();
        }
      }
    
      if (module_exists('image') && file_entity_file_get_mimetype_type($file) == 'image' && $file->filesize) {
        // If the image dimensions have changed, update any image field references
        // to this file and flush image style derivatives.
        if ($file->metadata['width'] != $file->metadata['width'] || $file->metadata['height'] != $file->metadata['height']) {
          _file_entity_update_image_field_dimensions($file);
        }
    
        // Flush image style derivatives whenever an image is updated.
        image_path_flush($file->uri);
      }
    
      // Clear any related field caches.
      file_entity_invalidate_field_caches($file);
    }
    

    Line 120 is if ($file->metadata['width'] != $file->metadata['width'] || $file->metadata['height'] != $file->metadata['height']) {

  • I then go to admin/content/file to check devel on a random transliterated file.

    On devel I check property metadata and I see:

    metadata (Array, 2 elements)
      height (Integer) 972
      width (Integer) 972
    

    which is the same as before transliteration (I checked on production site).

    But on devel/render I see this file array:

    file (Array, 4 elements)
      #theme (String, 15 characters ) image_formatter
      #item (Array, 17 elements)
      #image_style (String, 23 characters ) panopoly_image_original
      #path (String, 0 characters )
    

    While original file showed this array:

    file (Array, 6 elements)
      #theme (String, 5 characters ) image
      #path (String, 57 characters ) public://name of my file
      #width (Integer) 972
      #height (Integer) 972
      #alt (String, 0 characters )
      #title (String, 0 characters )
    
  • So to recap in devel/render of my file I see file array lacking #width and #height attributes.
  • I then go to the node which uses that file and I see everything working.
    There is only a minor issue with images inserted with wysiwyg interface. If I click on the image, then I hit on "add media" button which prompts the modal for embedding the image, and I want to change size say from "original size" to "quarter size", nothing happens. While before update 7100 (I check it in production site) this actions resulted in a img resize. If I delete the embed img and re-add it, everything is back to work.
  • So I am asking three questions:
    1. Is everything working good in nodes using transliterated images because panopoly access files using their internal system ids and hence are not affected by the WARNING in admin/config/media/file-system/transliteration?
    2. Is the Undefined property: stdClass::$metadata in file_entity_file_update() (line 120 of /sites/all/modules/contrib/file_entity/file_entity.file.inc) just saying transliteration process loose "width" and "height" attributes of renamed files?
    3. Is there any problem with that except the minor issue I noted?

Thank you very much

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.