VIM open a new tab
:tabnew .
To send the json data in JavaScript
var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance xmlhttp.open("POST", "/user/17352/post-dashboard"); xmlhttp.setRequestHeader("Content-Type", "application/json"); xmlhttp.send(JSON.stringify({advisorcomment:advisorComment}));
To receive the json data in PHP
$json_string = \Drupal::request()->getContent(); $decoded = \Drupal\Component\Serialization\Json::decode($json_string); print_r($decoded); $name = $decoded['name']; return new JsonResponse($name);
use Drupal\Core\Render\Markup;
$link_text = Markup::create('' . $title . '');
platform environment:activate new-feature
platform sql < my_database_backup.sql
platform db:dump --gzip
platform mount:upload
sed 's/\sDEFINER=`[^`]*`@`[^`]*`//g' -i oldfile.sql
var email = document.querySelector('#edit-investor-profiles-0-entity-field-email-0-value').value; if (email.length > 3) { // construct an HTTP request var xhr = new XMLHttpRequest(); var url = "/user/register/check-email" xhr.open("POST", url, true); xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); var data = JSON.stringify({"email": email}); // send the collected data as JSON xhr.send(JSON.stringify(data)); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) {
Open up Developer Tools and go to Sources.
Note the shortcut to pause script execution— F8 .
Interact with the UI to get the element to appear.
Hit F8 .
Now you can move your mouse around, inspect the DOM, whatever. The element will stay there.
https://stackoverflow.com/questions/17602611/inspect-a-hover-element
$result = $connection->insert('mytable') ->fields([ 'title' => 'Example', 'uid' => 1, 'created' => \Drupal::time()->getRequestTime(), ]) ->execute();
insert, update, delete, upsert
If yarn start or yarn watch is throwing any errors, try git pull, and then yarn install
Create an advancedqueue
create a file like advancedqueue.advancedqueue_queue.ipc_merge_sync.yml in modules/custom/ipc_syncdb/config/install
id: ipc_merge_sync label: 'IPC Merge Sync' backend: database backend_configuration: {} processor: cron processing_time: 180 locked: truethen import it with drush cim --partial --source=/home/ipc/www/ipc/docroot/modules/custom/ipc_syncdb/config/install
For a multiple-value field, to add the value to the end of the list, use the following code.
$node->field_code_used_by[] = ['target_id' => $user_id];
For a single use
$group_content1->group_roles->target_id = $role_id