Skip to content

Instantly share code, notes, and snippets.


arshad arshad

View GitHub Profile
arshad / settings.local.php
Created Dec 14, 2016
Example settings.local.php
View settings.local.php
* @file
* Local development override configuration feature.
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
* 'sites/default/settings.php' and uncomment the commented lines that mention
* 'settings.local.php'.
arshad / ActionsNoDropButton.php
Last active Aug 8, 2017
Add an actions_no_dropbutton Element to render form actions without the dropbutton
View ActionsNoDropButton.php
namespace Drupal\et_article\Element;
use Drupal\Core\Render\Element\Actions;
* Provides a wrapper element to render buttons for a form.
* Usage example:
* @code
arshad / gist:4c79632956564f1d2ef321ad6aa83941
Created May 11, 2016
Drupal Element::children in Twig templates
View gist:4c79632956564f1d2ef321ad6aa83941
{% for key, child in element if key|first != '#' %}
<div>{{ child }}</div>
{% endfor %}
arshad / gist:cde26afc528a7bc7ae8d68ce658a8f2d
Created Apr 21, 2016
field_info_instance or how to get field info in Drupal 8
View gist:cde26afc528a7bc7ae8d68ce658a8f2d
use Drupal\field\Entity\FieldConfig;
$info = FieldConfig::loadByName($entity_type, $bundle, $field_name);
arshad / assign_permission.php
Last active Apr 20, 2016
Progammatically assign permissions to users in Drupal 8
View assign_permission.php
use Drupal\user\RoleInterface;
// Allow anonymous and authenticated users to access contact form.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access site-wide contact form'));
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array('access site-wide contact form'));
arshad / create_menu_link.php
Last active Sep 10, 2018
Programmatically create a menu link in Drupal 8
View create_menu_link.php
View gist:8bf23df99e0af0752432ea159244a436
* Implements hook_forms().
function node_ajax_loader_forms($form_id, $args) {
$forms = array();
if (strncmp($form_id, 'node_ajax_loader_form_', 22) === 0) {
$forms[$form_id] = array('callback' => 'node_ajax_loader_form');
arshad / gist:5ea3aa3a4ce4cd345aa8
Created Dec 9, 2015
Drupal + Bootstrap + Sass + Gulp + Browsersync + FontAwesome
View gist:5ea3aa3a4ce4cd345aa8
Download and enable radix: drush en radix -y; drush vset theme_default radix
Create a subtheme: drush cc all; drush radix "Subtheme"
Set default theme: drush en subtheme -y; drush vset theme_default subtheme
Install required modules: cd /path/to/subtheme; npm run setup
Update browserSyncProxy in /path/to/subtheme/config.json
Watch: gulp
arshad / gist:3f78074de48ae295b341
Created Dec 1, 2014
Cocoapods stuck on “analyzing dependencies”
View gist:3f78074de48ae295b341

Run the following:

$ pod repo remove master
$ pod setup
$ pod install
arshad / gist:8b4c6e2404825c387450
Created Sep 2, 2014
Switch Panopoly Layouts to Radix Layouts.
View gist:8b4c6e2404825c387450
* Replace Panopoly layouts with Radix Layouts
* @param $plugin
* @param $info
function radix_ctools_plugin_post_alter(&$plugin, &$info) {
// If Radix Layouts module is installed.
// Switch all Panopoly Panels layouts to Radix Layouts.
if (module_exists('radix_layouts')) {
$radix_layouts_path = drupal_get_path('module', 'radix_layouts');