This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery('input:checkbox').attr("checked", "checked"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select nfd.nid,nfd.title, CASE casefield | |
| WHEN 0 THEN '0' | |
| WHEN 1 THEN '1' | |
| ELSE NULL | |
| END as casefieldalias | |
| from table1 nfd | |
| join table2 d on nfd.nid = d.tid | |
| where title like '%<%' or title like '%>%' and type in ('testtype'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Creating custom table in drupal 8 is not recommended. Create entity types instead. | |
| But if you want to Create custom table you can create either by implementing hook_schema or | |
| else create schema file config/schema/your_custom_module_name.schema.yml in your module | |
| (https://www.drupal.org/docs/8/api/configuration-api/configuration-schemametadata). | |
| ( https://drupal.stackexchange.com/questions/219580/best-practice-for-creating-table-in-custom-module ) | |
| 1. Implementing hook_schema in .module file (Not recommended). | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dbus-send --system \ | |
| /org/freedesktop/login1 \ | |
| org.freedesktop.login1.Manager.PrepareForSleep \ | |
| boolean:false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function attendance_management_field_widget_form_alter(&$element, &$form_state, &$context) { | |
| if ($element['#title'] == "class label" && $element['#field_parents']['0'] == 'field_sessions_classes') { | |
| $delta = $element['#delta']; | |
| $attendance = \Drupal::routeMatch()->getParameter('attendance'); | |
| $classlabel = $attendance->field_sessions_classes->referencedEntities()[$delta]->field_class_label->getValue()['0']['markup']; | |
| $element['markup']['#text'] = $classlabel; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form['actions']['submit']['#submit'][] = "attendanceSubmithandler"; | |
| or | |
| // Set redirect | |
| $form_state->setRedirect("attendance_management.feedback_message"); | |
| // attach library | |
| $form['#attached']['library'][] = 'attendance_management/fivestar_widget'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hook_preprocess_paragraph(&$variables) { | |
| //kint($variables['content']['field_class_label'][0]['#text']); die(); | |
| if ($variables['content']['field_class_label']['#items']) { | |
| $variables['content']['field_class_label'][0]['#text'] = $variables['content']['field_class_label']['#items']->getString(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $query = \Drupal::entityQuery('attendance') | |
| ->condition('type', 'student_attendance_tracking', '=') | |
| // entity refernce field | |
| ->condition('field_course', 433, '>='); | |
| $courseRatings = $query->execute(); | |
| return $courseRatings; | |
| // get all Course Ratings. | |
| function getCourseRatings($groupId) { | |
| $query = \Drupal::entityQuery('attendance') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $course_id = $values->_relationship_entities[order_items]->get('field_course')->target_id; | |
| $student_id = $values->_entity->get('uid')->target_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#time-report > tbody > tr.last-level").each(function( index ) { | |
| var text = $( this ).find("td.name").text(); | |
| // text will have "Support #20767: WG: Payment Transaction Failed Reminder " | |
| // pop() javascript function removes last element in a array | |
| // shift() javascript function removes first element in a array | |
| var issue_id = text.split('#').pop().split(':').shift(); | |
| var issuelink = $('<a href="/issues/' + issue_id + '" target="_blank">' + text + '</a>'); | |
| $( this ).find("td.name").html(issuelink); | |
| }); |