There is a lot of unused imports et al hanging around. Also we should make the code D9 ready and remove stuff marked for deprecation.

fe.

  • dropzone template

Also, the media library extending classes shall be simplified and thereby be more robust to changes.

Run drupal-check and phpcs!

CommentFileSizeAuthor
#11 3101860_phpcs_and_drupal_check-11.patch82.03 KBytsurk

Comments

ytsurk created an issue. See original summary.

  • ytsurk committed 2fcdb27 on 8.x-1.x
    Issue #3101860 by ytsurk: Removed unused includes and injected services...
ytsurk’s picture

Status: Active » Needs work
ytsurk’s picture

Issue summary: View changes
ytsurk’s picture

ytsurk’s picture

Issue summary: View changes
ytsurk’s picture

ytsurk’s picture

Issue summary: View changes

  • ytsurk committed 1e68c45 on 8.x-1.x
    Issue #3101860 by ytsurk: Reused Drupal object for getSelectedMids()
    
ytsurk’s picture

Title: Cleanup unused and obsolte code » Cleanup unused and obsolete code
ytsurk’s picture

Status: Needs work » Needs review
StatusFileSize
new82.03 KB

I now fixed all phpcs ERRORS except:

No key specified for array entry; first entry specifies key
And also disrespected the WARNINGS about the too long lines ;)

And all drupal-check(s) except:

 ------ --------------------------------------------------------------------------------------------------------------- 
  Line   modules/media_directories_editor/src/Plugin/Field/FieldFormatter/MediaDirectoriesImageDimensionsFormatter.php  
 ------ --------------------------------------------------------------------------------------------------------------- 
  70     Unsafe usage of new static().                                                                                  
         💡 Consider making the class or the constructor final.                                                          
  125    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$width.                                                              
  126    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$height.                                                             
  135    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$width.                                                              
  136    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$height.                                                             
  168    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$width.                                                              
  169    Access to an undefined property                                                                                
         Drupal\Core\Field\FieldItemListInterface::$height.                                                             
  192    Variable $media_items in PHPDoc tag @var does not match any variable                                           
         in the foreach loop: $delta, $media                                                                            
  194    Call to an undefined method                                                                                    
         Drupal\Core\Entity\EntityInterface::get().                                                                     
 ------ --------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   modules/media_directories_ui/media_directories_ui.module  
 ------ ---------------------------------------------------------- 
  70     Function libraries_get_path not found.                    
  242    Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getType().            
  470    Function libraries_get_path not found.                    
 ------ ---------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Controller/MediaDirectoriesController.php  
 ------ ---------------------------------------------------------------------------- 
  105    Unsafe usage of new static().                                               
         💡 Consider making the class or the constructor final.                       
 ------ ---------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/AddMediaFormBase.php             
 ------ ----------------------------------------------------------------------- 
  84     Unsafe usage of new static().                                          
         💡 Consider making the class or the constructor final.                  
  751    Call to an undefined method                                            
         Drupal\Core\Entity\EntityInterface::getName().                         
  751    Call to an undefined method                                            
         Drupal\Core\Entity\EntityInterface::setName().                         
  752    Method                                                                 
         Drupal\media_directories_ui\Form\AddMediaFormBase::createMediaFromVal  
         ue() should return Drupal\media\MediaInterface but returns             
         Drupal\Core\Entity\EntityInterface.                                    
 ------ ----------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/DirectoryDeleteForm.php         
 ------ ---------------------------------------------------------------------- 
  53     Unsafe usage of new static().                                         
         💡 Consider making the class or the constructor final.                 
  70     Method                                                                
         Drupal\media_directories_ui\Form\DirectoryDeleteForm::getCancelUrl()  
         should return Drupal\Core\Url but return statement is missing.        
 ------ ---------------------------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/FileUploadForm.php  
 ------ ---------------------------------------------------------- 
  52     Unsafe usage of new static().                             
         💡 Consider making the class or the constructor final.     
  76     Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getSetting().         
  78     Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getSetting().         
  81     Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getSettings().        
 ------ ---------------------------------------------------------- 

 ------ ------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/MediaCombinedUploadForm.php  
 ------ ------------------------------------------------------------------- 
  55     Unsafe usage of new static().                                      
         💡 Consider making the class or the constructor final.              
  121    Call to an undefined method                                        
         Drupal\Core\Entity\EntityInterface::getSettings().                 
  168    Call to an undefined method                                        
         Drupal\Core\Entity\EntityInterface::getSetting().                  
  203    Call to an undefined method                                        
         Drupal\Core\Entity\EntityInterface::getSetting().                  
 ------ ------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------ 
  Line   modules/media_directories_ui/src/Form/MediaDeleteForm.php         
 ------ ------------------------------------------------------------------ 
  48     Method                                                            
         Drupal\media_directories_ui\Form\MediaDeleteForm::getCancelUrl()  
         should return Drupal\Core\Url but return statement is missing.    
 ------ ------------------------------------------------------------------ 

 ------ ----------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/MediaEditForm.php                
 ------ ----------------------------------------------------------------------- 
  43     Method Drupal\media_directories_ui\Form\MediaEditForm::getMediaType()  
         should return Drupal\media\MediaTypeInterface but returns              
         Drupal\Core\Entity\EntityInterface|null.                               
 ------ ----------------------------------------------------------------------- 

 ------ ------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Form/OEmbedForm.php   
 ------ ------------------------------------------------------- 
  63     Unsafe usage of new static().                          
         💡 Consider making the class or the constructor final.  
  91     Call to an undefined method                            
         Drupal\media\MediaSourceInterface::getProviders().     
 ------ ------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Plugin/EntityBrowser/Widget/DirectoryBrowser.php  
 ------ ----------------------------------------------------------------------------------- 
  74     Unsafe usage of new static().                                                      
         💡 Consider making the class or the constructor final.                              
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   modules/media_directories_ui/src/Plugin/views/argument/StringContainsArgument.php  
 ------ ----------------------------------------------------------------------------------- 
  83     Call to an undefined method                                                        
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()              
         .                                                                                  
 ------ ----------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------- 
  Line   src/Form/MediaDirectoriesConfigForm.php                
 ------ ------------------------------------------------------- 
  37     Unsafe usage of new static().                          
         💡 Consider making the class or the constructor final.  
 ------ ------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/views/argument/MediaDirectoryArgument.php                   
 ------ ----------------------------------------------------------------------- 
  63     Unsafe usage of new static().                                          
         💡 Consider making the class or the constructor final.                  
  122    Call to an undefined method                                            
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()  
         .                                                                      
  124    Call to an undefined method                                            
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()  
         .                                                                      
  128    Call to an undefined method                                            
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()  
         .                                                                      
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/views/filter/MediaDirectory.php                             
 ------ ----------------------------------------------------------------------- 
  91     Unsafe usage of new static().                                          
         💡 Consider making the class or the constructor final.                  
  217    Call to an undefined method                                            
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()  
         .                                                                      
  222    Call to an undefined method                                            
         Drupal\views\Plugin\views\query\QueryPluginBase::addWhereExpression()  
         .                                                                      
 ------ ----------------------------------------------------------------------- 

 [ERROR] Found 41 errors  
ytsurk’s picture

Issue summary: View changes
ytsurk’s picture

Title: Cleanup unused and obsolete code » Cleanup :D [unused and obsolete] code -!-
Issue tags: +Coding standards

  • ytsurk committed f131d2c on 8.x-1.x
    Issue #3101860 by ytsurk: Cleanup :D [unused and obsolete] code
    
ytsurk’s picture

Status: Needs review » Fixed

  • ytsurk committed 46ed00d on 8.x-1.x
    Issue #3101860 by ytsurk: Further cleanup
    

Status: Fixed » Closed (fixed)

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