paragraphs_inline_entity_form.install in Paragraphs Inline Entity Form 8
Same filename and directory in other branches
Install file.
File
paragraphs_inline_entity_form.installView source
<?php
/**
 * @file Install file.
 */
use Drupal\embed\Entity\EmbedButton;
use Drupal\Core\File\FileSystemInterface;
/**
 * Implements hook_install().
 */
function paragraphs_inline_entity_form_install() {
  // Set the default icon.
  $icon = drupal_get_path('module', 'paragraphs_inline_entity_form') . '/images/paragraph_icon.png';
  $data = file_get_contents($icon);
  if ($file = file_save_data($data, 'public://paragraph_icon.png', FileSystemInterface::EXISTS_REPLACE)) {
    if ($embed_button = EmbedButton::load('paragraphs_inline_entity_form')) {
      $embed_button
        ->set('icon_uuid', $file
        ->uuid());
      $embed_button
        ->save();
    }
  }
}Functions
| 
            Name | 
                  Description | 
|---|---|
| paragraphs_inline_entity_form_install | Implements hook_install(). |