Skip to content

Instantly share code, notes, and snippets.

@mohit-rocks
mohit-rocks / import.php
Created December 4, 2018 11:56 — forked from crittermike/import.php
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
// Or, import YAML config an arbitrary directory.
@mohit-rocks
mohit-rocks / lando.yml-Step-1
Last active June 14, 2020 05:48
Local Mautic Development using Lando
name: mautic
recipe: lamp
config:
webroot: .
@mohit-rocks
mohit-rocks / ApiConsumer.php
Last active October 9, 2020 11:29
Creating Integrations Plugin in Mautic - Managing third-party Authentications in Mautic Plugin for Integrations
class ApiConsumer
{
// Other variables, methods declaration.
// Full code: https://github.com/mohit-rocks/HelloWorldBundle/blob/master/Connection/ApiConsumer.php
/**
* Fetch the data from API endpoint.
*/
public function getSubscribers()
{
$users = $this->client->get('v2/api/fetch-dummy-users');