Skip to content

Instantly share code, notes, and snippets.

View vijaycs85's full-sized avatar

Vijaya Chandran Mani vijaycs85

View GitHub Profile
diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php
index 6ccf8fd..6415e6b 100644
--- a/core/lib/Drupal/Core/Config/TypedConfigManager.php
+++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php
@@ -153,15 +153,15 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE, $va
// If the sub type has a bracket then lets look that up as well.
if (isset($value) && strpos($definition['type'], ']')) {
$sub_type = $this->replaceName($definition['type'], $value);
- $merge = $definitions[$sub_type];
- $definition = NestedArray::mergeDeepArray(array($merge, $definition), TRUE);
<?php
// playground.module file.
/**
* Implements hook_form_FORM_ID_alter().
*/
function playground_form_user_login_block_alter(&$form, &$form_state) {
$form['preference'] = array(
'#type' => 'select',
<?php
// playground.module
function playground_form_alter(&$form, &$form_state, $form_id) {
switch($form_id) {
case 'webform_client_form_1':
global $user;
if ($user->uid < 0) {
$form['submitted']['username']['#access'] = FALSE;
}
LogicException: Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary. in Drupal\Core\Site\Settings->__sleep() (line 67 of core/lib/Drupal/Core/Site/Settings.php).
serialize(Array)
Drupal\Component\Serialization\PhpSerialize::encode(Array)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire('form-pRbhHqrMfS0Ze2xmZj6YbazW8LgYH8vIFsV8ZBOwTow', Array, 21600)
Drupal\Core\Form\FormCache->setCache('form-pRbhHqrMfS0Ze2xmZj6YbazW8LgYH8vIFsV8ZBOwTow', Array, Object)
Drupal\Core\Form\FormBuilder->setCache('form-pRbhHqrMfS0Ze2xmZj6YbazW8LgYH8vIFsV8ZBOwTow', Array, Object)
Drupal\Core\Form\FormBuilder->processForm('error_style_form', Array, Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array)
select GROUP_CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(filename, '/', -1), '.', 1) SEPARATOR ',') as module from system \G
diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
index 16f68b0..bfe0211 100644
--- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
+++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
@@ -90,7 +90,7 @@ protected function prepareTimezone($timezone) {
* The formatted value of the date.
*/
public function format($format, $settings = array()) {
- $settings['langcode'] = !empty($settings['langcode']) ? $settings['langcode'] : $this->langcode;
+ $langcode = !empty($settings['langcode']) ? $settings['langcode'] : $this->langcode;
pjonckiere: vijaycs85: I'm a bit confused on that callback code, is there any way to use the new function without the $callback variable?
14:32 pjonckiere: vijaycs85: https://www.drupal.org/node/2429443
14:32 pjonckiere: vijaycs85: or is that impossible due to the variables?
14:32 vijaycs85: pjonckiere: not sure, how to.. we need to pass the language code
14:33 vijaycs85: pjonckiere: and I don't think we can make the language as property (as you can see it's calculated above the code from $this->langcode)
<?php
$file = field_file_load($data->node_data_field_media_file_field_media_file_fid);
$file_info = image_get_info($file['filepath']);
if ($file_info) {
$bytes = $file_info['file_size'];
$s = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$e = floor(log($bytes)/log(1024));
print sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e))));
}
?>
$user = new User($stoage);