This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @When /^(?:|I )fill in select2 input "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)" and select "(?P<entry>(?:[^"]|\\")*)"$/ | |
*/ | |
public function iFillInSelectInputWithAndSelect($field, $value, $entry) | |
{ | |
$page = $this->getSession()->getPage(); | |
$inputField = $page->find('css', $field); | |
if (!$inputField) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$route_name = \Drupal::service('current_route_match')->getRouteName(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema AS "Database", | |
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" | |
FROM information_schema.TABLES | |
GROUP BY table_schema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# KILL THEM ETAGS | |
# http://www.askapache.com/htaccess/apache-speed-etags.html | |
FileETag none | |
# set expires header | |
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|woff|eot|svg|ttf)$"> | |
Header set Expires "Tue, 16 Jun 2020 20:00:00 GMT" | |
</FilesMatch> | |
# turn on gzip compression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function mymodule_form_taxonomy_my_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// Hide fieldset relations for flat hierarchy taxonomies. | |
$form['relations']['#required'] = FALSE; | |
$form['relations']['#access'] = FALSE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { | |
if ($form_id == 'node_article_edit_form') { | |
$form['my_view'] = [ | |
'#markup' => 'Some arbitrary markup.', | |
]; | |
// Access entity object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$link_url = Url::fromRoute('node.add', array('node_type' => $content_type)); | |
$link_url->setOptions(array( | |
'attributes' => array( | |
'class' => array('button') | |
), | |
'query' => \Drupal::destination()->getAsArray(), | |
)); | |
$link_text = t('Add !content_type content', array('!content_type' => ucfirst($content_type))); | |
// Build link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch | grep -v "develop" | sed 's/^[ *]*//' | sed 's/^/git branch -d /' | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_leaflet_views_alter_points_data_alter(). | |
*/ | |
function fewo_map_leaflet_views_alter_points_data_alter($result, &$points) { | |
// Get node object of result. | |
$wrapped_node = entity_metadata_wrapper('node', $result->nid); | |
// Check if we have a category attached to node. | |
$category = $wrapped_node->field_sight_category->value(); | |
if (!empty($category)) { |