Skip to content

Instantly share code, notes, and snippets.

View tanmayk's full-sized avatar

Tanmay Khedekar tanmayk

  • Opensource Seed
  • India
View GitHub Profile
$('#my-submit').bind('ajaxSuccess', function() {
doStuff(this);
jQuery(this).unbind('ajaxSuccess');
});
(function($) {
Drupal.attachBehaviors = function (context, settings) {
context = context || document;
settings = settings || Drupal.settings;
// Execute all of Drupal behaviours.
jQuery.each(Drupal.behaviors, function () {
if (jQuery.isFunction(this.attach)) {
this.attach(context, settings);
}
});
#include 'stdio.h';
#include 'conio.h';
function void main(void) {
clrscr();
print_f("Hello world!!");
}
function example_dependent_options($key) {
$plakalar = array(1, 2); // These are keys from parent dropdown.
$iller = array(
'1' => array(
'1' => 'Aladağ'
),
'2' => array(
'5' => 'Aşkale')
/**
* Privacy level: Public.
* Field can be viewed by all.
*/
define('CORE_SECURITY_PRIVACY_PUBLIC', 0);
/**
* Privacy level: Friends only.
* Field can be viewed by only friends.
*/
/**
* Privacy settings form for user.
*/
function privacy_settings_form_callback($form, &$form_state) {
global $user;
$form = array();
$options = array(0 => 'Public', 1 => 'Friends', 2 => 'Private');
$instances = field_info_instances('user', 'user');
foreach ($instances as $field_name => $field_info) {
$form[$field_name] = array(
/**
* Implements hook_user_insert().
* Add default privacy settings.
*/
function MYMODULE_user_insert(&$edit, $account, $category) {
// Add default privacy settings into users.data
$instances = field_info_instances('user', 'user');
$field_settings = array();
foreach ($instances as $field_name => $field_info) {
// Lets make it PUBLIC by default.
/**
* Implements hook_field_access().
* Check if user has access for the field.
*/
function MYMODULE_field_access($op, $field, $entity_type, $entity, $account) {
if ($entity_type == 'user') {
switch ($op) {
case 'view':
global $user;
// Implement you access logic here for each field.
name: My Style
type: module
description: 'Provides a views display style for listings.'
package: Views
core: '8.x'
dependencies:
- views
<?php
/**
* @file
* Definition of Drupal\my_scroller\Plugin\views\style\Scroller.
*/
namespace Drupal\my_scroller\Plugin\views\style;
use Drupal\core\form\FormStateInterface;