Skip to main content
9 events
when toggle format what by license comment
Apr 13, 2017 at 12:47 history edited CommunityBot
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Jan 5, 2017 at 10:45 comment added 0711master I changed the if condition $node = Drupal::request()->attributes->get('node') back to your solution, because otherwise getCreatedTime() is throwing some null error when a page is restricted by Content Access module for whatever reason...
Jan 2, 2017 at 0:20 vote accept 0711master
Dec 29, 2016 at 12:55 comment added 0711master function THEME_preprocess_page(&$variables) { if ($node = \Drupal::request()->attributes->get('node')) { $variables['date_before'] = \Drupal::service('date.formatter')->format($variables['node']->getCreatedTime(), 'long_date_without_time'); } }
Dec 29, 2016 at 12:54 comment added 0711master Thank you! In the meantine I found the other answer too and combined it with another answer in the same thread:
Dec 28, 2016 at 5:42 history edited Yogesh CC BY-SA 3.0
Added similar question link, added formatter in code for css style.
Dec 28, 2016 at 5:37 comment added Yogesh Yes @YakimkinRoman, you're write. that would help style date differently. And since its a custom code we can alter it to match our needs. Thanks for pointing out, I'll update my answer with it.
Dec 28, 2016 at 5:35 comment added Yakimkin Roman I think it would be better to frame the date with tag to simplify setting of CSS styles.
Dec 28, 2016 at 5:18 history answered Yogesh CC BY-SA 3.0