Skip to content
Snippets Groups Projects
Commit f04b9141 authored by Brian Canini's avatar Brian Canini
Browse files

research ct updates

- style updates
- .theme functions for research and reorganization of functions
parent 8c772897
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
/*
* events and news filters
*/
if (($form['#id'] == 'views-exposed-form-events-page-1')||($form['#id'] == 'views-exposed-form-news-page-1')||($form['#id'] == 'views-exposed-form-research-project-directory-page-1')||($form['#id'] == 'views-exposed-form-research-project-gallery-page-1')||($form['#id'] == 'views-exposed-form-research-database-mobile-page-1')) {
if (($form['#id'] == 'views-exposed-form-events-page-1')||($form['#id'] == 'views-exposed-form-news-page-1')||($form['#id'] == 'views-exposed-form-research-project-directory-page-1')||($form['#id'] == 'views-exposed-form-research-project-gallery-page-1')||($form['#id'] == 'views-exposed-form-research-project-directory-mobile-page-1')||($form['#id'] == 'views-exposed-form-research-project-directory-block-1')||($form['#id'] == 'views-exposed-form-research-project-directory-mobile-block-1')) {
/*
* add new HTML content to filters (headers and spacer)
* and setting weights for where they should appear in the form hierarchy
......@@ -98,11 +98,12 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
$form['field_news_terms_2_target_id']['#weight'] = 3.5;
$form['keys']['#weight'] = 5;
$form['keys']['#attributes']['placeholder'] = t('Search Keywords');
}
/*
* checking if taxonomy has vocabulary - if not, don't display field
*/
//events
if ($form['#id'] == 'views-exposed-form-events-page-1') {
if(count($form['field_evt_taxonomy_target_id_1']['#options']) == 1) {
$form['field_evt_taxonomy_target_id_1']['#access'] = FALSE;
}
......@@ -110,7 +111,9 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_evt_taxonomy2_target_id']['#options']) == 1) {
$form['field_evt_taxonomy2_target_id']['#access'] = FALSE;
}
}
//news
if ($form['#id'] == 'views-exposed-form-news-page-1') {
if(count($form['field_news_terms_1_target_id']['#options']) == 1) {
$form['field_news_terms_1_target_id']['#access'] = FALSE;
}
......@@ -118,7 +121,9 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_news_terms_2_target_id']['#options']) == 1) {
$form['field_news_terms_2_target_id']['#access'] = FALSE;
}
}
//research
if (($form['#id'] == 'views-exposed-form-research-project-directory-block-1')||($form['#id'] == 'views-exposed-form-research-project-directory-page-1')) {
if(count($form['field_research_departments_target_id']['#options']) == 1) {
$form['field_research_departments_target_id']['#access'] = FALSE;
}
......@@ -130,7 +135,9 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_research_year_target_id']['#options']) == 1) {
$form['field_research_year_target_id']['#access'] = FALSE;
}
}
//research - mobile
if (($form['#id'] == 'views-exposed-form-research-project-directory-mobile-block-1')||($form['#id'] == 'views-exposed-form-research-project-directory-mobile-page-1')) {
if(count($form['field_research_departments_target_id']['#options']) == 0) {
$form['field_research_departments_target_id']['#access'] = FALSE;
}
......@@ -142,22 +149,108 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
if(count($form['field_research_year_target_id']['#options']) == 0) {
$form['field_research_year_target_id']['#access'] = FALSE;
}
/*
* research filters - setting default value on select box to taxonomy vocabulary
*/
}
/*
* research filters - setting default value on select box to taxonomy vocabulary
*/
if (($form['#id'] == 'views-exposed-form-research-project-directory-block-1')||($form['#id'] == 'views-exposed-form-research-project-directory-page-1')) {
if(count($form['field_research_departments_target_id']['#options']['#value']) == "All") {
$form['field_research_departments_target_id']['#options']['All'] = $form['#info']['filter-field_research_departments_target_id']['label'];
// $form['field_research_departments_target_id']['#options']['All'] = $form['#info']['filter-field_research_departments_target_id']['label'];
$tarr = array_slice(array_keys($form['field_research_departments_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_departments_target_id']['#options']['All'] = $vocab_label;
}
}
}
if(count($form['field_research_other_target_id']['#options']['#value']) == "All") {
$form['field_research_other_target_id']['#options']['All'] = $form['#info']['filter-field_research_other_target_id']['label'];
//$form['field_research_other_target_id']['#options']['All'] = $form['#info']['filter-field_research_other_target_id']['label'];
$tarr = array_slice(array_keys($form['field_research_other_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_other_target_id']['#options']['All'] = $vocab_label;
}
}
}
if(count($form['field_research_year_target_id']['#options']['#value']) == "All") {
$form['field_research_year_target_id']['#options']['All'] = $form['#info']['filter-field_research_year_target_id']['label'];
//$form['field_research_year_target_id']['#options']['All'] = $form['#info']['filter-field_research_year_target_id']['label'];
$tarr = array_slice(array_keys($form['field_research_year_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_year_target_id']['#options']['All'] = $vocab_label;
}
}
}
}
/*
* Research Mobile filters
*/
if (($form['#id'] == 'views-exposed-form-research-project-directory-mobile-block-1')||($form['#id'] == 'views-exposed-form-research-project-directory-mobile-page-1')) {
if($form['field_research_departments_target_id']['#theme_wrappers']['details']['#title'] == 'Departments') {
$tarr = array_slice(array_keys($form['field_research_departments_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_departments_target_id']['#theme_wrappers']['details']['#title'] = $vocab_label;
}
}
}
if($form['field_research_other_target_id']['#theme_wrappers']['details']['#title'] == 'Other') {
$tarr = array_slice(array_keys($form['field_research_other_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_other_target_id']['#theme_wrappers']['details']['#title'] = $vocab_label;
}
}
}
if($form['field_research_year_target_id']['#theme_wrappers']['details']['#title'] == 'Year') {
$tarr = array_slice(array_keys($form['field_research_year_target_id']['#options']), 1, 5, true);
$tid = array_shift($tarr);
$term = Term::load($tid);
if (!empty($term)) {
$vid = array_shift($term->vid->getValue())['target_id'];
if(!empty($vid)) {
$vocab = Vocabulary::load($vid);
$vocab_label = $vocab->get('name');
$form['field_research_year_target_id']['#theme_wrappers']['details']['#title'] = $vocab_label;
}
}
}
}
/*
* people filters
*/
......@@ -169,6 +262,7 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
$form['field_appointment_target_id']['#access'] = FALSE;
}
else {
// $form['field_appointment_target_id']['#validated'] = TRUE;
$tid = array_shift(array_keys($form['field_appointment_target_id']['#options']));
$term = Term::load($tid);
if (!empty($term)) {
......@@ -185,6 +279,7 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
$form['field_research_interests_target_id']['#access'] = FALSE;
}
else {
// $form['field_research_interests_target_id']['#validated'] = TRUE;
$tid = array_shift(array_keys($form['field_research_interests_target_id']['#options']));
$term = Term::load($tid);
if (!empty($term)) {
......@@ -202,6 +297,7 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
$form['field_other_target_id']['#access'] = FALSE;
}
else {
// $form['field_other_target_id']['#validated'] = TRUE;
$tid = array_shift(array_keys($form['field_other_target_id']['#options']));
$term = Term::load($tid);
if (!empty($term)) {
......@@ -240,3 +336,22 @@ function asc_bootstrap_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $
$form['field_research_interests_target_id']['#weight'] = 4;
}
}
function asc_bootstrap_views_pre_render(\Drupal\views\ViewExecutable $view) {
// print " - view_current_display: " . $view->current_display;
if($view->id() == 'research_project_directory' || $view->id() == 'research_project_directory_mobile') {
// get vocabulary name and set label to it
$vocab_dep = Vocabulary::load('departments');
$vocab_dep_label = $vocab_dep->get('name');
$vocab_year = Vocabulary::load('year');
$vocab_year_label = $vocab_year->get('name');
$vocab_other = Vocabulary::load('other');
$vocab_other_label = $vocab_other->get('name');
$view->field['field_research_departments']->options['label'] = $vocab_dep_label;
$view->field['field_research_year']->options['label'] = $vocab_year_label;
$view->field['field_research_other']->options['label'] = $vocab_other_label;
}
}
......@@ -174,7 +174,7 @@
}
// --------------------------------------------------
//## Research filters.
//## Research Directory.
.view-research-project-directory {
......@@ -223,7 +223,7 @@
// --------------------------------------------------
//## Research Directory Mobile.
.view-research-database-mobile {
.view-research-project-directory-mobile {
.view-filters {
background: #D8D8D8;
padding: 10px;
......
......@@ -7,6 +7,34 @@
//## Research Directory.
.page-node-type-research-landing-page {
.block-views-blockresearch-project-directory-mobile-block-1 {
display: none;
}
.block-views-blockresearch-project-directory-block-1 {
.form-inline .control-label {
position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
}
}
@media (max-width: 992px) {
.block-views-blockresearch-project-directory-block-1 {
display: none;
}
.block-views-blockresearch-project-directory-mobile-block-1 {
display: block;
}
}
}
.view-research-project-directory {
table {
......
......@@ -10509,80 +10509,80 @@ article .field--name-body {
}
/* line 227, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .view-filters {
.view-research-project-directory-mobile .view-filters {
background: #D8D8D8;
padding: 10px;
}
/* line 232, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .filter-heading {
.view-research-project-directory-mobile .filter-heading {
color: #225D62;
width: 100%;
}
/* line 237, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-item {
.view-research-project-directory-mobile .form-item {
background: #ffffff;
padding: 5px 10px;
border-radius: 8px;
margin: 10px 0;
}
/* line 244, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-type-textfield {
.view-research-project-directory-mobile .form-type-textfield {
width: 100%;
background: transparent;
padding: 0;
}
/* line 249, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-type-textfield label {
.view-research-project-directory-mobile .form-type-textfield label {
display: none;
}
/* line 253, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-type-textfield .form-control {
.view-research-project-directory-mobile .form-type-textfield .form-control {
width: 100%;
border-radius: 0;
}
/* line 259, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-type-textfield {
.view-research-project-directory-mobile .form-type-textfield {
margin-right: 10px;
}
/* line 262, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-type-textfield input {
.view-research-project-directory-mobile .form-type-textfield input {
min-width: 250px;
}
/* line 269, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .select-wrapper select {
.view-research-project-directory-mobile .select-wrapper select {
min-width: 250px;
}
/* line 273, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .select-wrapper:after {
.view-research-project-directory-mobile .select-wrapper:after {
color: #555555;
font-size: 12px;
}
/* line 279, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-actions {
.view-research-project-directory-mobile .form-actions {
min-width: 50%;
}
/* line 282, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-actions .button {
.view-research-project-directory-mobile .form-actions .button {
text-transform: uppercase;
border-radius: 0;
}
/* line 289, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .views-row .views-col {
.view-research-project-directory-mobile .views-row .views-col {
background: #F9F9F9;
border: #DDD solid 1px;
padding: 20px;
margin-bottom: 15px;
}
/* line 297, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-item-field-research-departments-target-id-all {
.view-research-project-directory-mobile .form-item-field-research-departments-target-id-all {
display: none;
}
/* line 301, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-item-field-research-other-target-id-all {
.view-research-project-directory-mobile .form-item-field-research-other-target-id-all {
display: none;
}
/* line 305, ../assets/sass/components/_filters.scss */
.view-research-database-mobile .form-item-field-research-year-target-id-all {
.view-research-project-directory-mobile .form-item-field-research-year-target-id-all {
display: none;
}
......@@ -12047,99 +12047,123 @@ article.news-story {
#block-views-block-people-directory-block-1 .views-field.views-field-mail a {
font-size: smaller;
}*/
/* line 14, ../assets/sass/components/_research.scss */
/* line 12, ../assets/sass/components/_research.scss */
.page-node-type-research-landing-page .block-views-blockresearch-project-directory-mobile-block-1 {
display: none;
}
/* line 17, ../assets/sass/components/_research.scss */
.page-node-type-research-landing-page .block-views-blockresearch-project-directory-block-1 .form-inline .control-label {
position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
}
@media (max-width: 992px) {
/* line 28, ../assets/sass/components/_research.scss */
.page-node-type-research-landing-page .block-views-blockresearch-project-directory-block-1 {
display: none;
}
/* line 32, ../assets/sass/components/_research.scss */
.page-node-type-research-landing-page .block-views-blockresearch-project-directory-mobile-block-1 {
display: block;
}
}
/* line 42, ../assets/sass/components/_research.scss */
.view-research-project-directory table .views-field-title {
width: 35%;
}
/* line 18, ../assets/sass/components/_research.scss */
/* line 46, ../assets/sass/components/_research.scss */
.view-research-project-directory table .views-field-field-research-year {
width: 10%;
}
@media (max-width: 992px) {
/* line 18, ../assets/sass/components/_research.scss */
/* line 46, ../assets/sass/components/_research.scss */
.view-research-project-directory table .views-field-field-research-year {
width: 15%;
}
}
/* line 34, ../assets/sass/components/_research.scss */
/* line 62, ../assets/sass/components/_research.scss */
.page-node-type-research article {
margin-bottom: 16px;
}
/* line 38, ../assets/sass/components/_research.scss */
/* line 66, ../assets/sass/components/_research.scss */
.page-node-type-research .page-header {
display: none;
}
/* line 42, ../assets/sass/components/_research.scss */
/* line 70, ../assets/sass/components/_research.scss */
.page-node-type-research .research-title-wrapper {
padding-left: 0;
}
/* line 46, ../assets/sass/components/_research.scss */
/* line 74, ../assets/sass/components/_research.scss */
.page-node-type-research .research-cont {
padding-left: 0;
}
/* line 49, ../assets/sass/components/_research.scss */
/* line 77, ../assets/sass/components/_research.scss */
.page-node-type-research .research-cont .field--name-field-research-body {
margin: 20px 0 40px;
}
/* line 54, ../assets/sass/components/_research.scss */
/* line 82, ../assets/sass/components/_research.scss */
.page-node-type-research .research-users {
margin-bottom: 15px;
}
/* line 57, ../assets/sass/components/_research.scss */
/* line 85, ../assets/sass/components/_research.scss */
.page-node-type-research .research-users h2 {
line-height: 0;
font-size: 18px;
}
/* line 63, ../assets/sass/components/_research.scss */
/* line 91, ../assets/sass/components/_research.scss */
.page-node-type-research .taxonomy-research-heading {
width: 100%;
padding-top: 15px;
}
/* line 67, ../assets/sass/components/_research.scss */
/* line 95, ../assets/sass/components/_research.scss */
.page-node-type-research .taxonomy-research-heading h3 {
line-height: 0;
font-size: 18px;
}
/* line 77, ../assets/sass/components/_research.scss */
/* line 105, ../assets/sass/components/_research.scss */
.research .field--name-field-research-body {
margin-bottom: 20px;
}
/* line 89, ../assets/sass/components/_research.scss */
/* line 117, ../assets/sass/components/_research.scss */
.view-research-project-gallery .row {
display: flex;
margin-bottom: 40px;
}
/* line 95, ../assets/sass/components/_research.scss */
/* line 123, ../assets/sass/components/_research.scss */
.view-research-project-gallery .form-actions .button {
text-transform: uppercase;
border-radius: 0;
}
/* line 101, ../assets/sass/components/_research.scss */
/* line 129, ../assets/sass/components/_research.scss */
.view-research-project-gallery .view-filters {
background: #D8D8D8;
padding: 10px;
}
/* line 109, ../assets/sass/components/_research.scss */
/* line 137, ../assets/sass/components/_research.scss */
.page-node-type-research-project-gallery article {
margin-bottom: 16px;
}
/* line 113, ../assets/sass/components/_research.scss */
/* line 141, ../assets/sass/components/_research.scss */
.page-node-type-research-project-gallery .page-header {
display: none;
}
/* line 117, ../assets/sass/components/_research.scss */
/* line 145, ../assets/sass/components/_research.scss */
.page-node-type-research-project-gallery .rgall-title-wrapper {
padding-left: 0;
}
/* line 121, ../assets/sass/components/_research.scss */
/* line 149, ../assets/sass/components/_research.scss */
.page-node-type-research-project-gallery .rgall-cont {
padding-left: 0;
}
/* line 124, ../assets/sass/components/_research.scss */
/* line 152, ../assets/sass/components/_research.scss */
.page-node-type-research-project-gallery .rgall-cont .field--name-body {
margin: 20px 0 40px;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment