WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Drupal 8 basic query work (entityQuery)

Submitted by barnettech on Sun, 02/17/2019 - 14:43
  $nids = \Drupal::entityQuery('node')
  ->condition('type', 'my_custom_type')
  ->execute();
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
    $connection = \Drupal::database();
    $query = $connection->query("SELECT * FROM {node} n WHERE type > :type", [
      ':type' => 'article',
    ]);
    $result = $query->fetchAll();
    foreach ($result as $item) {
      $node = \Drupal\node\Entity\Node::load($item->nid);
      //dpm($node);
      $title = $node->get('title')->getValue();
      $title = $title[0]['value']);

  $database = \Drupal::database();

Getting text / a string from SimpleXMLElement Object

Submitted by barnettech on Sun, 02/10/2019 - 20:05
if (file_exists(drupal_get_path('module', 'complimentmigration') . '/MyManual08-088-18.xml')) {
      $xml = simplexml_load_file(drupal_get_path('module', 'complimentmigration') . '/MyManual08-088-18.xml');
      $xml2 = (string) $xml->section->version->title;
      drupal_set_message('
' . print_r($xml2, TRUE) . '

');
}

reference: https://stackoverflow.com/questions/2867575/get-value-from-simplexmlele…

Lua, what is dt, dy, and dx

Submitted by barnettech on Thu, 01/31/2019 - 20:34

number dx
The amount moved along the x-axis since the last time love.mousemoved was called.
number dy
The amount moved along the y-axis since the last time love.mousemoved was called.

dt is the most common shorthand for delta-time, which is usually passed through love.update to represent the amount of time which has passed since it was last called. It is in seconds, but because of the speed of modern processors is usually smaller than 1 values like 0.01 are common.

so the ball will move accordingly every dt