Skip to content

Instantly share code, notes, and snippets.

View cyberlex404's full-sized avatar
🏠
Working from home

Lex Misiuro cyberlex404

🏠
Working from home
View GitHub Profile
@cyberlex404
cyberlex404 / GallerySyncProcessor.php
Last active October 13, 2017 08:07
Queue Worker Plugin
<?php
/**
* Created by PhpStorm.
* User: Lex
* Date: 03.10.2017
* Time: 0:26
*/
namespace Drupal\housing_sync\Plugin\QueueWorker;
<?php
namespace Drupal\housing\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Housing entities.
*/
class HousingViewsData extends EntityViewsData {
<?php
namespace Drupal\views\Plugin\views\relationship;
use Drupal\views\Plugin\ViewsHandlerManager;
use Drupal\views\Views;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* A relationship handlers which reverse entity references.
<?php
namespace Drupal\housing\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Housing entities.
*/
class HousingViewsData extends EntityViewsData {
commands:
aliases:
debug:container:
- cod
config:edit:
- cdit
cron:execute:
- cre
cron:release:
- crr
<?php
/**
* Implements hook_form_alter().
*/
function extra_form_alter(&$form, &$form_state, $form_id) {
if ( isset($_GET['show']) && $_GET['show'] != '' ) {
$nid = $_GET['show'];
}
if ($form_id == 'webform_client_form_140') {
<?php
/**
* Created by PhpStorm.
* User: Lex
* Date: 20.10.2017
* Time: 11:47
*/
/**
* Implements hook_menu().
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@cyberlex404
cyberlex404 / ajaxForm.php
Created November 3, 2017 12:05 — forked from alexey-kuznetsov/ajaxForm.php
Working ajax form with multiple commands in response
/**
* AJAX process step
*/
public function processStep(array &$form, FormStateInterface $form_state) {
$ajax_response = new AjaxResponse();
$ajax_response->addCommand(new ReplaceCommand(
'h1.page-title',
'<h1 class="page-title">' . $this->getTitle() . '</h1>'
));
@cyberlex404
cyberlex404 / MODULE_form_user_login_form_alter.module
Created November 30, 2017 07:29
MODULE_form_user_login_form_alter
<?php
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Component\Render\FormattableMarkup;
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function MODULE_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {