public static function setEmbedButtonIcon($module_name, $file_name, $embed_button_name) {
    $icon = \Drupal::moduleHandler()->getModule($module_name)->getPath() . '/images/' . $file_name;
    $fs = \Drupal::service('file_system');
    $destination = file_unmanaged_copy($icon, 'public://' . $fs->basename($icon));

    if ($destination) {
      $file = File::create(['uri' => $destination]);
      $file->save();

      EmbedButton::load($embed_button_name)
        ->set('icon_uuid', $file->uuid())
        ->save();
    }
  }
public static function setEmbedButtonIcon($module_name, $file_name, $embed_button_name) {
    $icon = \Drupal::moduleHandler()->getModule($module_name)->getPath() . '/images/' . $file_name;
    $fs = \Drupal::service('file_system');
    $destination = file_unmanaged_copy($icon, 'public://' . $fs->basename($icon));

    if ($destination) {
      $file = File::create(['uri' => $destination]);
      $file->save();

      EmbedButton::load($embed_button_name)
        ->set('icon_uuid', $file->uuid())
        ->save();
    }
  }
public static function setEmbedButtonIcon ( $ module_name , $ file_name , $ embed_button_name ) { $ icon = \ Drupal :: moduleHandler ( ) -> getModule ( $ module_name ) -> getPath ( ) . '/images/' . $ file_name ; $ fs = \ Drupal :: service ( 'file_system' ) ; $ destination = file_unmanaged_copy ( $ icon , 'public://' . $ fs -> basename ( $ icon ) ) ; if ( $ destination ) { $ file = File :: create ( [ 'uri' => $ destination ] ) ; $ file -> save ( ) ; EmbedButton :: load ( $ embed_button_name ) -> set ( 'icon_uuid' , $ file -> uuid ( ) ) -> save ( ) ; } }
Helper that upload icon for embed button and add it to configuration.

@param string $module_name
Media bundle module name.
@param string $file_name
File name within /images folder.
@param string $embed_button_name
Embed button name.
Helper that upload icon for embed button and add it to configuration .