You are here

function paragraphs_inline_entity_form_install in Paragraphs Inline Entity Form 8

Same name and namespace in other branches
  1. 2.x paragraphs_inline_entity_form.install \paragraphs_inline_entity_form_install()
  2. 2.0.x paragraphs_inline_entity_form.install \paragraphs_inline_entity_form_install()

Implements hook_install().

File

./paragraphs_inline_entity_form.install, line 12
Install file.

Code

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();
    }
  }
}