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
'[{"timetableId":0,"timetableTitle":"Friday evening","startTime":"22:00","endTime":"10:00","events":[{"eventId":0,"featureTitle":"Ses","featureDescription":"\\u003Cp\\u003Ezdsvzsdvsd\\u003C\\/p\\u003E","featureLink":"","sessions":[{"start":"2018-03-09 19:00:00","duration":"0:15","link":"","linkText":"","title":"Event 3","text":""}]},{"eventId":1,"featureTitle":"AEG Taste Theatre","featureDescription":"\\u003Cp\\u003Esefsefwsefwef\\u003C\\/p\\u003E","featureLink":"https:\\/\\/google.com","sessions":[{"start":"2018-03-09 18:00:00","duration":"0:30","link":"https:\\/\\/www.google.com","linkText":"scscsc","title":"Event 2","text":"\\u003Cp\\u003Ewdwdwd\\u003C\\/p\\u003E"},{"start":"2018-03-09 20:00:00","duration":"0:45","link":"https:\\/\\/www.google.com","linkText":"sswsdwdw","title":"Event 1","text":"\\u003Cp\\u003Ewadawdadawdwad\\u003C\\/p\\u003E"}]}]}]' |
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
#calendar { | |
width: 100%; | |
} | |
#calendar ul.days { | |
list-style: none; | |
padding: 0; | |
margin: 0; | |
width: 100%; | |
} |
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 | |
global $base_path; | |
global $base_url; | |
$path = getcwd(); | |
$file_path = variable_get('file_public_path', conf_path() . '/files'); | |
$rootPath = realpath($path); | |
$zip = new ZipArchive(); | |
$zip->open($path . '/' . $file_path . '/project_damp.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); | |
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY); |
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 | |
$count = 0; | |
$records = db_select('system', 's') | |
->fields('s', array('filename', 'name', 'type', 'status')) | |
->execute() | |
->fetchAll(); | |
if (!empty($records)) { | |
foreach ($records as $record) { |
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 | |
// Some entity alias (node, taxonomy_term, user, etc). | |
$alias = '/about'; | |
// Get URL obj. | |
$url = Url::fromUri('internal:' . $alias); | |
// Check exist alias. | |
if ($url->isRouted()) { | |
$params = $url->getRouteParameters(); | |
$entity_type = key($params); | |
// GEt entity. |
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 | |
$result = db_query('SHOW TABLES'); | |
foreach ($result as $row) { | |
if (preg_match('/field_deleted_data_.*/', $row->Tables_in_|your_db_name|)) { | |
db_drop_table($row->Tables_in_|your_db_name|); | |
} | |
if (preg_match('/field_deleted_revision_.*/', $row->Tables_in_|your_db_name|)) { | |
db_drop_table($row->Tables_in_|your_db_name|); | |
} |
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 | |
$array = array( | |
'nodes' => 5, | |
'left' => array( | |
'nodes' => 2, | |
'left' => array( | |
'nodes' => 1 | |
), | |
), | |
'right' => array( |
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 | |
/** | |
* @file | |
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlockByURI. | |
*/ | |
namespace Drupal\mymodule\Plugin\Block; | |
use Drupal\Core\Block\BlockBase; |
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 | |
// Rander array. | |
$link = Link::fromTextAndUrl(t('Edit'), Url::fromRoute('entity.node.edit_form', [ | |
'node' => 123, | |
]))->toRenderable(); | |
// Just string | |
$link = Link::fromTextAndUrl(t('Edit'), Url::fromRoute('entity.node.edit_form', [ | |
'node' => 123, | |
]))->toString(); |
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_template_preprocess_default_variables_alter(). | |
*/ | |
function MYMODULE_template_preprocess_default_variables_alter(&$variables) { | |
$current_path = \Drupal::service('path.current')->getPath(); | |
$variables['current_path'] = $current_path; | |
} |