Skip to content

Instantly share code, notes, and snippets.

View patilvishalvs's full-sized avatar

Vishal Patil patilvishalvs

  • Mumbai, India
View GitHub Profile
@patilvishalvs
patilvishalvs / addext.php
Created February 22, 2017 06:43 — forked from bnchdrff/addext.php
add extensions to file_managed entities
<?php
use Drupal\Core\File\FileSystem;
use Drupal\file\Entity\File;
$container = \Drupal::getContainer();
$eq = $container->get('entity.query');
$fs = $container->get('file_system');
@patilvishalvs
patilvishalvs / README.md
Created February 22, 2017 06:45 — forked from bnchdrff/README.md
Add POST endpoint for performant Drupal 8 REST file uploads

Instead of accepting serialized files, I wanted to process file uploads as multipart/form-data.

I also wanted to use the crsf prevention API.

This is what I came up with. Replace modulename with your module and fileupload with whatever you want to name your class/endpoint.

In your routing.yml:

@patilvishalvs
patilvishalvs / AddMoreRemoveForm.php
Last active January 9, 2018 07:02
Add remove form elements with tabledrag and ajax drupal 8.x
<?php
namespace Drupal\experiments\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\SortArray;
/**
* Class AddMoreForm.
@patilvishalvs
patilvishalvs / navbar_transparent.css
Created December 26, 2017 12:27 — forked from Papillard/navbar_transparent.css
Transparent navbar for Bootstrap over-ride @lewagon
.navbar-transparent{
background: transparent;
border: none;
}
.navbar-transparent .navbar-nav > li > a,
.navbar-transparent .navbar-nav > li > a:hover
{
color: white;
line-height: 50px;
@patilvishalvs
patilvishalvs / embedded-file-viewer.md
Created October 5, 2018 15:00 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links