Created
          May 18, 2018 14:07 
        
      - 
      
- 
        Save nelson-ph/c30507761df286ac652f984f30d263c7 to your computer and use it in GitHub Desktop. 
    Drupal 8 - Prevent Call to undefined method Drupal\\Core\\Field\\BaseFieldDefinition::getThirdPartySettings
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Index: ./filefield_paths.module | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| --- ./filefield_paths.module (date 1517934386000) | |
| +++ ./filefield_paths.module (date 1517934386000) | |
| @@ -344,13 +344,15 @@ | |
| if ($field instanceof FileFieldItemList) { | |
| /** @var FieldConfig $definition */ | |
| $definition = $field->getFieldDefinition(); | |
| - $settings = $definition->getThirdPartySettings('filefield_paths'); | |
| - if (isset($settings['enabled']) && $settings['enabled']) { | |
| - // Invoke hook_filefield_paths_process_file(). | |
| - foreach (\Drupal::moduleHandler() | |
| - ->getImplementations('filefield_paths_process_file') as $module) { | |
| - if (function_exists($function = "{$module}_filefield_paths_process_file")) { | |
| - $function($entity, $field, $settings); | |
| + if(method_exists($definition, 'getThirdPartySettings')){ | |
| + $settings = $definition->getThirdPartySettings('filefield_paths'); | |
| + if (isset($settings['enabled']) && $settings['enabled']) { | |
| + // Invoke hook_filefield_paths_process_file(). | |
| + foreach (\Drupal::moduleHandler() | |
| + ->getImplementations('filefield_paths_process_file') as $module) { | |
| + if (function_exists($function = "{$module}_filefield_paths_process_file")) { | |
| + $function($entity, $field, $settings); | |
| + } | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment