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
use Drupal\views\Views; | |
$display_plugins = Views::pluginManager('display')->getDefinitions(); | |
$plugin_ids = []; | |
foreach ($display_plugins as $id => $definition) { | |
// if ($definition['provider'] == 'views' || $definition['provider'] == 'views_data_export') { | |
if ($definition['provider'] == 'views') { | |
$plugin_ids[] = $id; | |
} | |
} |
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
Follow this 2 links | |
https://github.com/squizlabs/PHP_CodeSniffer | |
http://www.kianmeng.org/2015/05/is-your-drupal-code-adheres-to-coding.html |
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
$config = \Drupal::config('system.theme'); | |
$theme_settings = \Drupal::config($config->get('default') . '.settings')->get(); | |
$variables['logo_path'] = file_create_url($theme_settings['logo']['path']); | |
dpm( $variables['logo_path']); |
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
use Drupal\Component\Datetime\DateTimePlus; | |
$format = "D"; | |
// create current datetime. | |
$current_date = new DateTimePlus(); | |
// Format $current_date to dispaly, what ever php datetime format you needed. here I am formatting to 'D' | |
$current_day = $current_date->format($format, ['timezone' => drupal_get_user_timezone()]); |
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
use Drupal\Component\Datetime\DateTimePlus; | |
$format = "D"; | |
$current_date = new DateTimePlus(); | |
$current_timezone = date_default_timezone_get(); | |
date_default_timezone_set("UTC"); | |
$current_day = $current_date->format($format, ['timezone' => drupal_get_user_timezone()]); | |
$lastweek = 'last Sunday -1 week'; | |
$dateformat = 'Y-m-d\TH:i:s'; |
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
$query = \Drupal::entityQueryAggregate('group_content') | |
->condition('type', 'section-group_node-session', '=') | |
->condition('entity_id.entity.field_session_from_time1', $startdaydate, '>=') | |
->condition('entity_id.entity.field_session_to_time1',$endaydate, '<=') | |
->groupBy('gid'); | |
// result we will get group by field values not group_content entity ids | |
$result = $query->execute(); | |
dpm($result); | |
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
drush sql-dump --structure-tables-list=cache,cache_* > dumpfile.sql |
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
jQuery(".course-rating-statics-toggle").hover(function() { | |
jQuery(this).children('.course-rating-statics').toggle(); | |
}); | |
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
use Drupal\Core\Url; | |
use Drupal\Core\Render\Markup; | |
$options = [ | |
'attributes' => [ | |
'class' => [ | |
'use-ajax', | |
], | |
'data-dialog-type' => "modal", | |
'data-dialog-options' => [ |
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
$("#time-report > tbody > tr.last-level").each(function( index ) { | |
var text = $( this ).find("td.name").text(); | |
// text will have "Support #20767: WG: Payment Transaction Failed Reminder " | |
// pop() javascript function removes last element in a array | |
// shift() javascript function removes first element in a array | |
var issue_id = text.split('#').pop().split(':').shift(); | |
var issuelink = $('<a href="/issues/' + issue_id + '" target="_blank">' + text + '</a>'); | |
$( this ).find("td.name").html(issuelink); | |
}); |
OlderNewer