Skip to content

Instantly share code, notes, and snippets.

View asipple1's full-sized avatar

Andrew Sipple asipple1

View GitHub Profile
function convert_number_to_word($num = FALSE) {
$num = str_replace([',', ' '], '', trim($num));
if (!$num) {
return FALSE;
}
$num = (int) $num;
$words = [];
$list1 = [
'', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten',
'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen',
use Drupal\Core\Form\FormStateInterface;
function hook_form_alter(&$form, FormStateInterface $form_state, $form_id) {
switch ($form_id) {
// Alter login form and add own custom submit handler.
case 'user_login_form':
$form['#submit'][] = '_statefair_user_login_form_submit';
break;
}
}
/* --------------------------
* RESPONSIVE MIXINS
* -------------------------- */
$respond-to-queries: (smartphone: 'all and (max-width: 600px)',
tablet-portrait: 'all and (max-width: 768px)',
tablet: 'all and (max-width: 1024px)',
desktop-medium: 'all and (max-width: 1240px)'
);
import debounce from 'lodash/debounce';
window.addEventListener('resize', debounce(resizeFunction, 100), false);
function resizeFunction() {
// If the window matches the media query then close the menu
if (window.matchMedia('(max-width: 1080px)').matches) {
// Resize things here.
}
}
/* --------------------------
* TABLE STYLING
* -------------------------- */
$table-background-color: $color-white;
$table-background-color-even: $color-light-grey;
$table-cell-border-color: $color-mid-grey;
$thead-background-color: $color-dark-blue;
$thead-text-color: $color-white;
use Drupal\views\Views;
parse_str($_SERVER['QUERY_STRING'], $url_query_array);
$results_view = Views::getView('view_display_name');
$results_view->setDisplay('view_machine_name');
$results_view->setArguments($url_query_array);
$results_view->preExecute();
$results_view->execute();
$view_results_count = $results_view->total_rows;