recentpopularlog in

therobyouknow : howto   1709

« earlier  
8 - How can I import the configuration on a different site? - Drupal Answers
drush config-get "system.site" uuid
And you can change it with

check the incoming uuid (from git) with:
cat ../config/sync/system.site.yml

drush config-set "system.site" uuid "fjfj34-e3bb-2ab8-4d21-9100-b5etgetgd99d5"
config  uuid  mismatch  match  howto  problem  solution  d8  8  drupal  drupal8  web  dev  cms  computing  drush 
8 weeks ago by therobyouknow
reactjs - React—add a click listener to dangerouslySetInnerHTML sub-element - Stack Overflow
class Element extends React.Component {
state = {
loadTime: 0,
lastUpdate: 0
};

lastUpdateTimer = null;

componentDidMount() {
this.resetTimer();

this.lastUpdateTimer = setInterval(this.setLastUpdate, 1000);

this.dynamicContentElement.addEventListener("click", this.handleClick)
}

componentWillUnmount() {
clearInterval(this.lastUpdateTimer);
this.dynamicContentElement.removeEventListener(this.handleClick)
}

resetTimer() {
const now = Date.now();

this.setState({
loadTime: now,
lastUpdate: now
});
}

setLastUpdate = () => {
this.setState({
lastUpdate: Date.now()
});
}

getDynamicContent() {
const time = Math.round((this.state.lastUpdate - this.state.loadTime) / 1000);
return {
__html: `<p>
You are here: <strong>${time}</strong> seconods.
<br>
<button id="btn">Click to reset counter</button>
</p>`
};
}

handleClick = (e) => {
if (e.target.id === "btn") {
this.resetTimer();
}
}

render() {
return (
<div>
Dynamic content below:
<div
ref={el => this.dynamicContentElement = el}
dangerouslySetInnerHTML={this.getDynamicContent()}
/>
</div>
);
}
}
reactjs  react  js  javascript  computing  listener  click  onclick  element  subelement  sub  howto  web  dev  event  events 
april 2019 by therobyouknow
WordPress: Wrap Text Around Video with this Little Trick - WPMU DEV
works for Drupal too in WYSIWYG editor
CDATA in tag so that <style> is not discarded
wrap  text  video  web  dev  computing  howto  html  css 
april 2019 by therobyouknow
8 - How can we get Block Bundle Type for block in code? - Drupal Answers
use \Drupal\block_content\BlockContentInterface;


/**
* Implements HOOK_preprocess_block().
*
* @param $variables
*/
function mymodule_preprocess_block(&$variables) {
$content = $variables['elements']['content'];
if (isset($content['#block_content']) && $content['#block_content'] instanceof BlockContentInterface) {

if ($content['#block_content']->bundle() == 'xxx') {
// ...
}

}
}
8  drupal8  drupal  web  dev  cms  computing  module  theme  block  update  refresh  force  cache  disable  twig  specific  howto  question  answer  problem  solution  time  computed  generated  calculated 
march 2019 by therobyouknow
« earlier      
per page:    204080120160

Copy this bookmark:





to read