diff --git a/profiles/drupalru/themes/druru/css/style.css b/profiles/drupalru/themes/druru/css/style.css index 55dcf0e4..718255bc 100644 --- a/profiles/drupalru/themes/druru/css/style.css +++ b/profiles/drupalru/themes/druru/css/style.css @@ -67,7 +67,8 @@ mark { background: #ff0; color: #000; } -small { +small, +.events--front .event__date { font-size: 80%; } sub, @@ -309,7 +310,9 @@ img { .thumbnail > img, .thumbnail a > img, .carousel-inner > .item > img, -.carousel-inner > .item > a > img { +.carousel-inner > .item > a > img, +.events--front .event > img, +.events--front .event a > img { display: block; max-width: 100%; height: auto; @@ -498,7 +501,8 @@ p { } } small, -.small { +.small, +.events--front .event__date { font-size: 86%; } mark, @@ -3546,7 +3550,8 @@ a.badge:focus { font-size: 68px; } } -.thumbnail { +.thumbnail, +.events--front .event { display: block; padding: 4px; margin-bottom: 18px; @@ -3563,16 +3568,22 @@ a.badge:focus { transition: all border 0.2s ease-in-out ease-out; } .thumbnail > img, -.thumbnail a > img { +.thumbnail a > img, +.events--front .event > img, +.events--front .event a > img { margin-left: auto; margin-right: auto; } a.thumbnail:hover, a.thumbnail:focus, -a.thumbnail.active { +a.thumbnail.active, +a.events--front .event:hover, +a.events--front .event:focus, +a.events--front .event.active { border-color: #4687b7; } -.thumbnail .caption { +.thumbnail .caption, +.events--front .event .caption { padding: 9px; color: #333333; } @@ -8687,54 +8698,6 @@ body.front .jumbotron + * { body.front .jumbotron p { font-weight: 300; } -body.front .block-simple-events .event-list { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; - -webkit-flex-flow: row; - flex-wrap: nowrap; - overflow: auto; - margin-left: -15px; - margin-right: -15px; -} -@media screen and (min-width: 1004px) { - body.front .block-simple-events .event-list { - margin-left: 0; - margin-right: 0; - } -} -body.front .block-simple-events .event-list .thumbnail { - margin-right: 2%; - margin-bottom: 0; - min-width: 292px; - width: 32%; - display: flex; - flex-direction: column; - -ms-flex-direction: column; -} -body.front .block-simple-events .event-list .thumbnail:last-child { - margin-right: 0; -} -body.front .block-simple-events .event-list .thumbnail.add-more-link { - display: block; - border-width: 3px; - border-style: dashed; - font-size: 5em; - text-align: center; - line-height: 5em; - -webkit-transition: all 0.2s ease-out; - -moz-transition: all 0.2s ease-out; - -o-transition: all 0.2s ease-out; - transition: all 0.2s ease-out; -} -body.front .block-simple-events .event-list .thumbnail .caption { - font-weight: 300; -} -body.front .block-simple-events .event-list .thumbnail .form-actions { - margin-top: auto; -} body .frontpage-list .h4 { margin: 0; padding-right: 15px; @@ -8770,6 +8733,39 @@ body .frontpage-list .list-group .list-group-item:hover, body .alttracker.list-group .list-group-item:hover { background: rgba(0, 0, 0, 0.1); } +body.page-events .node-event img { + max-width: 100%; + height: auto; +} +body.page-events .node-event iframe { + max-width: 100%; +} +@media screen and (min-width: 748px) { + body.page-events #block-system-main { + padding-left: 60px; + margin-left: 96px; + border-left: 1px solid #6ab7dd; + } + body.page-events .event-date { + position: absolute; + left: -165.25px; + line-height: 1.3em; + font-size: 0.5em; + color: #df9b10; + } + body.page-events .event-date:after { + display: block; + content: ''; + position: absolute; + width: 13px; + height: 13px; + border-radius: 50%; + border: 1px solid; + right: -35px; + top: 0.3em; + background: #fafafa; + } +} .pager-wrapper { clear: left; } @@ -9958,10 +9954,6 @@ fieldset[disabled] #block-advanced-sphinx-searchbox .search-sphinx:focus + butto .node-event .details { margin-left: 0; } -.node-event .image img { - max-width: 100%; - height: auto; -} .node-event .event-type { margin-top: 5px; } @@ -9987,33 +9979,39 @@ span.geshifilter code, .front .region-sidebar-second .block-ymb:first-child { margin-top: -12px; } -.event-block-container { - width: 32%; - margin-bottom: 0; - min-width: 280px; +.events--front .view-content { + display: flex; justify-content: space-between; - float: left; - margin-right: 10px; - height: 340px; + overflow: auto; +} +.events--front .event { + border: 1px solid rgba(0, 0, 0, 0.1); + margin: 0 15px 0 0; + min-width: 290px; padding: 10px; + width: 33.33%; } -.event-block-container .event-block-title h3 { - display: inline-block; +.events--front .event:last-child { + margin-right: 0; } -.event-block-container .event-block-date { - display: inline; +.events--front .event:last-child:nth-child(2) { + margin-right: auto; } -.event-block-container .event-block-date .field-content { - display: inline; +.events--front .event__image { + margin: -10px -10px 0 -10px; } -.event-block-container .event-block-desc { - font-weight: 300; +.events--front .event__title { + margin: 10px 0 0; } -#block-views-events-block { - overflow: auto; +.events--front .event__date { + margin-top: 10px; } -#block-views-events-block .view-content { - display: flex; +.events--front .event__desc { + margin-top: 10px; +} +.events--front .event__desc * { + font-weight: normal !important; + margin: 0; } [aria-label] { position: relative; @@ -10930,43 +10928,6 @@ fieldset[disabled] #inner_poll_add_field_link a.focus { .inner_poll.jumbotron .inner-poll-unauthorized { margin-top: 10px; } -.event-image { - max-width: 100%; - height: auto; -} -@media screen and (min-width: 748px) { - .page-events #block-system-main { - padding-left: 60px; - margin-left: 96px; - border-left: 1px solid #6ab7dd; - } - .page-events .event-date { - position: absolute; - left: -165.25px; - line-height: 1.3em; - font-size: 0.5em; - color: #df9b10; - } - .page-events .event-date:after { - display: block; - content: ''; - position: absolute; - width: 13px; - height: 13px; - border-radius: 50%; - border: 1px solid; - right: -35px; - top: 0.3em; - background: #fafafa; - } -} -.page-events .main .main-content { - background: none; - border: none; -} -.block-simple-events img { - max-width: 100%; -} .node.node-organization { margin-top: 18px; padding-top: 18px; @@ -11569,3 +11530,4 @@ sup.beta { line-height: 0.3em; margin: 0; } +/*# sourceMappingURL=style.css.map */ \ No newline at end of file diff --git a/profiles/drupalru/themes/druru/less/drupal/components/_blocks.less b/profiles/drupalru/themes/druru/less/drupal/components/_blocks.less index 56dcba3b..7dff2a9e 100644 --- a/profiles/drupalru/themes/druru/less/drupal/components/_blocks.less +++ b/profiles/drupalru/themes/druru/less/drupal/components/_blocks.less @@ -1,5 +1,5 @@ .block-ymb { - background-color:lighten(@brand-accent, 38%); + background-color: lighten(@brand-accent, 38%); border: 1px solid @brand-accent; padding: @padding-large-vertical @padding-large-horizontal !important; margin-left: -@padding-large-horizontal; @@ -11,37 +11,49 @@ } } -.event-block-container { - width: 32%; - margin-bottom: 0; - min-width: 280px; - justify-content: space-between; - float: left; - margin-right: 10px; - height: 340px; - padding: 10px; - - .event-block-title h3 { - display: inline-block; +.events--front { + .view-content { + display: flex; + justify-content: space-between; + overflow: auto; } - .event-block-date { - display: inline; + .event { + &:extend(.thumbnail all); + border: 1px solid @little-darker; + margin: 0 @padding-large-horizontal 0 0; + min-width: 290px; + padding: @padding-small-horizontal; + width: 33.33%; - .field-content { - display: inline; + &:last-child { + margin-right: 0; + + &:nth-child(2) { + margin-right: auto; + } } - } - .event-block-desc { - font-weight: 300; - } -} + &__image { + margin: -@padding-small-horizontal -@padding-small-horizontal 0 -@padding-small-horizontal; + } -#block-views-events-block { - overflow: auto; + &__title { + margin: @padding-small-horizontal 0 0; + } - .view-content { - display: flex; + &__date { + &:extend(small); + margin-top: @padding-small-horizontal; + } + + &__desc { + margin-top: @padding-small-horizontal; + + * { + font-weight: normal !important; + margin: 0; + } + } } } diff --git a/profiles/drupalru/themes/druru/less/drupal/components/_event.less b/profiles/drupalru/themes/druru/less/drupal/components/_event.less index 3fee4bdb..3c026363 100644 --- a/profiles/drupalru/themes/druru/less/drupal/components/_event.less +++ b/profiles/drupalru/themes/druru/less/drupal/components/_event.less @@ -14,6 +14,7 @@ .image { margin-bottom: @padding-base-vertical; } + > * { margin-bottom: @padding-small-vertical; @@ -36,15 +37,19 @@ float: left; } } + &.image { margin-bottom: @padding-large-vertical; } + &.website:before { content: "\f0c1"; } + &.address:before { content: "\f041"; } + &.event-type { &:before { content: "\f05a"; @@ -53,10 +58,12 @@ display: inline; } } + &.date_time { &:before { content: "\f073"; } + a > * { margin-right: @padding-small-horizontal; display: inline; @@ -64,15 +71,11 @@ } } } + .details { margin-left: 0; } - .image { - img { - max-width: 100%; - height: auto; - } - } + .event-type { margin-top: 5px; } diff --git a/profiles/drupalru/themes/druru/less/drupal/components/_pages.less b/profiles/drupalru/themes/druru/less/drupal/components/_pages.less index 2e6ff69e..99ad41cd 100644 --- a/profiles/drupalru/themes/druru/less/drupal/components/_pages.less +++ b/profiles/drupalru/themes/druru/less/drupal/components/_pages.less @@ -127,62 +127,6 @@ body { font-weight: 300; } } - - .block-simple-events { - .event-list { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; - - -webkit-flex-flow: row; - flex-wrap: nowrap; - overflow: auto; - - margin-left: -@padding-large-horizontal; - margin-right: -@padding-large-horizontal; - - @media @very-smalld { - & { - margin-left: 0; - margin-right: 0; - } - } - - .thumbnail { - margin-right: 2%; - margin-bottom: 0; - min-width: 292px; - width: 32%; - display: flex; - flex-direction: column; - -ms-flex-direction: column; - - &:last-child { - margin-right: 0; - } - - &.add-more-link { - display: block; - border-width: 3px; - border-style: dashed; - font-size: 5em; - text-align: center; - line-height: 5em; - .transition(); - } - - .caption { - font-weight: 300; - } - - .form-actions { - margin-top: auto; - } - } - } - } } .frontpage-list { @@ -223,4 +167,52 @@ body { } } } + + &.page-events { + @timeline-width: 96px; + @point-size: 13px; + + .node-event { + img { + max-width: 100%; + height: auto; + } + + // Temp workaround to prevent embedded videos from overlapping container + // @todo: Refactor embedding of external videos + // see https://getbootstrap.com/docs/3.3/components/#responsive-embed + iframe { + max-width: 100%; + } + } + + @media @tablet { + #block-system-main { + padding-left: @grid-gutter-width*2; + margin-left: @timeline-width; + border-left: 1px solid @brand-info; + } + + .event-date { + position: absolute; + left: -(@timeline-width + (@grid-gutter-width*2.5) - (@well-padding-lg-horizontal/2) + (@point-size/2)-1px); + line-height: 1.3em; + font-size: 0.5em; + color: @brand-accent; + + &:after { + display: block; + content: ''; + position: absolute; + width: @point-size; + height: @point-size; + border-radius: 50%; + border: 1px solid; + right: -35px; + top: .3em; + background: @body-bg; + } + } + } + } } diff --git a/profiles/drupalru/themes/druru/less/drupal/modules/_initial.less b/profiles/drupalru/themes/druru/less/drupal/modules/_initial.less index 201295f9..a9be18c3 100644 --- a/profiles/drupalru/themes/druru/less/drupal/modules/_initial.less +++ b/profiles/drupalru/themes/druru/less/drupal/modules/_initial.less @@ -7,7 +7,6 @@ @import "_bueditor"; @import "_alttracker"; @import "_inner_poll"; -@import "_simple_events"; @import "_marketplace"; @import "_fz152"; @import "_dru_tickets"; diff --git a/profiles/drupalru/themes/druru/less/drupal/modules/_simple_events.less b/profiles/drupalru/themes/druru/less/drupal/modules/_simple_events.less deleted file mode 100644 index 64af762d..00000000 --- a/profiles/drupalru/themes/druru/less/drupal/modules/_simple_events.less +++ /dev/null @@ -1,49 +0,0 @@ -.event-image { - max-width: 100%; - height: auto; -} - -.page-events { - @timeline-width: 96px; - @point-size: 13px; - - @media @tablet { - #block-system-main { - padding-left: @grid-gutter-width*2; - margin-left: @timeline-width; - border-left: 1px solid @brand-info; - } - - .event-date { - position: absolute; - left: -(@timeline-width + (@grid-gutter-width*2.5) - (@well-padding-lg-horizontal/2) + (@point-size/2)-1px); - line-height: 1.3em; - font-size: 0.5em; - color: @brand-accent; - - &:after { - display: block; - content: ''; - position: absolute; - width: @point-size; - height: @point-size; - border-radius: 50%; - border: 1px solid; - right: -35px; - top: .3em; - background: @body-bg; - } - } - } - - .main .main-content { - background: none; - border: none; - } -} - -.block-simple-events { - img { - max-width: 100%; - } -} \ No newline at end of file diff --git a/profiles/drupalru/themes/druru/less/drupal/modules/_views.less b/profiles/drupalru/themes/druru/less/drupal/modules/_views.less index 3066e773..9f93b4ed 100644 --- a/profiles/drupalru/themes/druru/less/drupal/modules/_views.less +++ b/profiles/drupalru/themes/druru/less/drupal/modules/_views.less @@ -2,9 +2,11 @@ .views-row { border-bottom: 1px solid #e6e6e6; border-top: 1px solid #fff; + &:last-child { border-bottom: none; } + &:first-child { border-top: none; } @@ -15,6 +17,7 @@ .row-title { float: left; width: 90%; + > a { text-overflow: ellipsis; white-space: nowrap; @@ -23,22 +26,26 @@ max-width: 100%; float: left; } + > sup + a { padding-right: 3px; max-width: 75%; } + @media @phone { width: 95%; > sup + a { max-width: 85%; } } + @media @tablet { width: 97%; > sup + a { max-width: 93%; } } + @media @very-smalld { width: 91%; > sup + a { @@ -67,4 +74,4 @@ } } } -} \ No newline at end of file +} diff --git a/profiles/drupalru/themes/druru/theme/block/block.vars.php b/profiles/drupalru/themes/druru/theme/block/block.vars.php index 2d6bdcce..7cdeaf62 100644 --- a/profiles/drupalru/themes/druru/theme/block/block.vars.php +++ b/profiles/drupalru/themes/druru/theme/block/block.vars.php @@ -20,6 +20,8 @@ function druru_preprocess_block(&$variables) { $additional_preprocess .= '__'; $additional_preprocess .= $block->delta; + $additional_preprocess = str_replace('-', '_', $additional_preprocess); + if (function_exists($additional_preprocess)) { $additional_preprocess($variables); } @@ -41,42 +43,6 @@ function druru_preprocess_block__drurum__new(&$variables) { } } -/** - * Add icon "plus" for quickly adding node at the forum. - */ -function druru_preprocess_block__simple_events__upcoming_events(&$variables) { - $elements = &$variables['elements']; - if (!isset($elements['links'])) { - return; - } - $elements['links']['#attributes']['class'][] = 'list-inline'; - if (!empty($elements['links']['#links'])) { - $links = &$elements['links']['#links']; - if (!empty($links['list']['title'])) { - $title = druru_icon('list', FALSE, array( - 'class' => array('text-accent'), - )); - $links['list']['title'] = $title . t('More'); - $links['list']['html'] = TRUE; - } - // The link should be available always. - if (!isset($links['add'])) { - $links = array( - 'add' => array( - 'title' => t('Create'), - 'href' => 'node/add/simple-event', - 'html' => TRUE, - ), - ) + $links; - } - $title = druru_icon('plus', FALSE, array( - 'class' => array('text-accent'), - )); - $links['add']['title'] = $title . t('Create'); - $links['add']['html'] = TRUE; - } -} - /** * Implements hook_process_block(). */ @@ -84,3 +50,8 @@ function druru_process_block(&$variables) { // Drupal 7 should use a $title variable instead of $block->subject. $variables['title'] = $variables['block']->subject; } + +function druru_preprocess_block__views__events_upcoming_block_block(&$variables) { + $variables['block_html_id'] = 'events--front'; + $variables['classes_array'] = ['events--front']; +} diff --git a/profiles/drupalru/themes/druru/theme/event/views-view-fields--events-upcoming-block--block.tpl.php b/profiles/drupalru/themes/druru/theme/event/views-view-fields--events-upcoming-block--block.tpl.php index 11e7fb98..e6f0ea10 100644 --- a/profiles/drupalru/themes/druru/theme/event/views-view-fields--events-upcoming-block--block.tpl.php +++ b/profiles/drupalru/themes/druru/theme/event/views-view-fields--events-upcoming-block--block.tpl.php @@ -25,10 +25,7 @@ */ ?> -
-
content; ?>
-

content; ?>

-
content; ?>
-
-
content; ?>
-
+
content; ?>
+

content; ?>

+
content; ?>
+
content; ?>
diff --git a/profiles/drupalru/themes/druru/theme/views/views-view-unformatted.vars.php b/profiles/drupalru/themes/druru/theme/views/views-view-unformatted.vars.php new file mode 100644 index 00000000..cf8a5a56 --- /dev/null +++ b/profiles/drupalru/themes/druru/theme/views/views-view-unformatted.vars.php @@ -0,0 +1,17 @@ +name == 'events_upcoming_block') { + foreach ($view->result as $id => $row) { + $vars['classes_array'][$id] = 'event'; + } + } +} diff --git a/profiles/drupalru/themes/druru/theme/views/views_view_field.vars.php b/profiles/drupalru/themes/druru/theme/views/views_view_field.vars.php new file mode 100644 index 00000000..8a8e9577 --- /dev/null +++ b/profiles/drupalru/themes/druru/theme/views/views_view_field.vars.php @@ -0,0 +1,21 @@ +name == 'events_upcoming_block') { + if ($field->field == 'field_event_date') { + $event_start = format_date(strtotime($row->field_field_event_date[0]['raw']['value']), 'short'); + $event_end = format_date(strtotime($row->field_field_event_date[0]['raw']['value2']), 'short'); + $vars['output'] = $event_start . ($event_start != $event_end ? ' — ' . $event_end : ''); + } + } +} diff --git a/sites/all/modules/custom/drurum/drurum.install b/sites/all/modules/custom/drurum/drurum.install index c76ce67c..9fd0bf9b 100644 --- a/sites/all/modules/custom/drurum/drurum.install +++ b/sites/all/modules/custom/drurum/drurum.install @@ -807,6 +807,7 @@ function drurum_update_7043() { module_disable(['simple_events']); drupal_uninstall_modules(['simple_events']); } + module_enable(['date']); module_enable(['date_views']); module_enable(['link']); @@ -831,417 +832,11 @@ function drurum_update_7043() { variable_set('node_submitted_event', '0'); variable_set('node_options_event', ['status']); - $field = [ - 'translatable' => '0', - 'settings' => [ - 'uri_scheme' => 'public', - 'default_image' => 0, - ], - 'field_name' => 'field_event_image', - 'type' => 'image', - 'active' => '1', - 'locked' => '0', - 'cardinality' => '1', - ]; - field_create_field($field); - - $instance = [ - 'label' => $t('Image'), - 'widget' => [ - 'weight' => '41', - 'type' => 'image_image', - 'active' => 1, - 'settings' => [ - 'progress_indicator' => 'throbber', - 'preview_image_style' => 'thumbnail', - ], - ], - 'settings' => [ - 'file_directory' => 'events_images', - 'file_extensions' => 'png gif jpg jpeg', - 'max_filesize' => '', - 'max_resolution' => '300x200', - 'min_resolution' => '300x200', - 'alt_field' => 0, - 'title_field' => 0, - 'default_image' => '54136', - 'user_register_form' => FALSE, - ], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'image', - 'settings' => [ - 'image_style' => '', - 'image_link' => '', - ], - 'weight' => 0, - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - ], - 'required' => 0, - 'description' => '', - 'field_name' => 'field_event_image', - 'entity_type' => 'node', - 'bundle' => 'event', - ]; - field_create_instance($instance); - - $field = [ - 'translatable' => '0', - 'settings' => [ - 'granularity' => [ - 'month' => 'month', - 'day' => 'day', - 'year' => 'year', - ], - 'tz_handling' => 'site', - 'timezone_db' => 'UTC', - 'cache_enabled' => 0, - 'cache_count' => '4', - 'todate' => 'optional', - ], - 'field_name' => 'field_event_date', - 'type' => 'datetime', - 'active' => '1', - 'locked' => '0', - 'cardinality' => '1', - ]; - field_create_field($field); - - $instance = [ - 'label' => 'Date', - 'widget' => [ - 'weight' => '4', - 'type' => 'date_popup', - 'active' => 1, - 'settings' => [ - 'input_format' => 'd.m.Y', - 'year_range' => '-10:+10', - 'label_position' => 'above', - 'text_parts' => [], - 'no_fieldset' => 0, - 'input_format_custom' => '', - 'increment' => 15, - ], - ], - 'settings' => [ - 'default_value' => 'now', - 'default_value_code' => '', - 'default_value2' => 'same', - 'default_value_code2' => '', - 'user_register_form' => FALSE, - ], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'date_default', - 'weight' => '1', - 'settings' => [ - 'format_type' => 'short', - 'fromto' => 'both', - 'multiple_number' => '', - 'multiple_from' => '', - 'multiple_to' => '', - 'show_remaining_days' => 0, - ], - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - ], - 'required' => 1, - 'description' => '', - 'field_name' => 'field_event_date', - 'entity_type' => 'node', - 'bundle' => 'event', - ]; - field_create_instance($instance); - - $field = [ - 'translatable' => '0', - 'settings' => [ - 'attributes' => [ - 'target' => 'default', - 'class' => '', - 'rel' => '', - ], - 'url' => 0, - 'title' => 'optional', - 'title_value' => '', - 'title_maxlength' => 128, - 'enable_tokens' => 1, - 'display' => [ - 'url_cutoff' => 80, - ], - ], - 'field_name' => 'field_event_link', - 'type' => 'link_field', - 'active' => '1', - 'locked' => '0', - 'cardinality' => '1', - ]; - field_create_field($field); - - $instance = [ - 'label' => 'Url', - 'widget' => [ - 'weight' => '5', - 'type' => 'link_field', - 'active' => 0, - 'settings' => [], - ], - 'settings' => [ - 'absolute_url' => 1, - 'validate_url' => 1, - 'url' => 0, - 'title' => 'none', - 'title_value' => '', - 'title_allowed_values' => '', - 'title_label_use_field_label' => 0, - 'title_maxlength' => '128', - 'enable_tokens' => 1, - 'display' => [ - 'url_cutoff' => '80', - ], - 'attributes' => [ - 'target' => 'default', - 'rel' => '', - 'configurable_class' => 0, - 'class' => '', - 'configurable_title' => 0, - 'title' => '', - ], - 'rel_remove' => 'default', - 'user_register_form' => FALSE, - ], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'link_url', - 'weight' => '2', - 'settings' => [], - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'above', - 'settings' => [], - 'weight' => 0, - ], - ], - 'required' => 0, - 'description' => '', - 'default_value' => NULL, - 'field_name' => 'field_event_link', - 'entity_type' => 'node', - 'bundle' => 'event', - ]; - field_create_instance($instance); - - $field = [ - 'translatable' => '0', - 'settings' => [ - 'max_length' => '255', - ], - 'field_name' => 'field_event_address', - 'type' => 'text', - 'active' => '1', - 'locked' => '0', - 'cardinality' => '1', - ]; - field_create_field($field); - - $instance = [ - 'label' => $t('Address'), - 'widget' => [ - 'weight' => '44', - 'type' => 'text_textfield', - 'active' => 1, - 'settings' => [ - 'size' => '60', - ], - ], - 'settings' => [ - 'text_processing' => '0', - 'user_register_form' => FALSE, - ], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'text_default', - 'settings' => [], - 'weight' => 3, - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - ], - 'required' => 1, - 'description' => '', - 'default_value' => NULL, - 'field_name' => 'field_event_address', - 'entity_type' => 'node', - 'bundle' => 'event', - ]; - field_create_instance($instance); - - $field = [ - 'translatable' => '0', - 'settings' => [ - 'allowed_values' => [ - 0 => [ - 'vocabulary' => 'event_types', - 'parent' => '0', - ], - ], - ], - 'field_name' => 'field_event_type', - 'type' => 'taxonomy_term_reference', - 'active' => '1', - 'locked' => '0', - 'cardinality' => '1', - ]; - field_create_field($field); - - $instance = [ - 'label' => $t('Type'), - 'widget' => [ - 'weight' => '45', - 'type' => 'options_select', - 'active' => 1, - 'settings' => [], - ], - 'settings' => [ - 'user_register_form' => FALSE, - ], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'taxonomy_term_reference_link', - 'settings' => [], - 'weight' => 4, - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - ], - 'required' => 1, - 'description' => '', - 'default_value' => NULL, - 'field_name' => 'field_event_type', - 'entity_type' => 'node', - 'bundle' => 'event', - ]; - field_create_instance($instance); - - $instance = [ - 'field_name' => 'body', - 'entity_type' => 'node', - 'label' => $t('Description'), - 'bundle' => 'event', - 'widget' => [], - 'display' => [ - 'default' => [ - 'label' => 'hidden', - 'type' => 'text_default', - 'settings' => [], - 'weight' => 4, - ], - 'teaser' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'frontpage' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - 'block' => [ - 'type' => 'hidden', - 'label' => 'hidden', - 'settings' => [], - 'weight' => 0, - ], - ], - ]; - field_create_instance($instance); + // Create fields and fields' instances + $files = file_scan_directory(drupal_get_path('module', 'drurum') . '/includes/fields', '/.*\.inc$/'); + foreach ($files as $filepath => $file) { + require_once $filepath; + } $item = array( 'link_path' => 'node/add/event', @@ -1253,27 +848,11 @@ function drurum_update_7043() { ); menu_link_save($item); - // Get weight of the main content block - $block_main_weight = db_query("SELECT weight FROM {block} WHERE module = 'system' AND delta = 'main' AND region = 'content' AND theme = 'druru'")->fetchField(); - - // Load events block to get its bid - $block_events_upcoming = block_load('views', 'events_upcoming_block-block'); - - db_insert('block') - ->fields([ - 'module' => 'views', - 'delta' => 'events_upcoming_block-block', - 'status' => '1', - 'weight' => $block_main_weight + 1, - 'region' => 'content', - 'custom' => '0', - 'visibility' => '1', - 'pages' => '', - 'theme' => 'druru', - 'bid' => $block_events_upcoming->bid, - 'cache' => '-1', - ]) - ->execute(); + // Create views + $files = file_scan_directory(drupal_get_path('module', 'drurum') . '/includes/views', '/.*\.inc$/'); + foreach ($files as $filepath => $file) { + require_once $filepath; + } } // Delete manually created link for Events diff --git a/sites/all/modules/custom/drurum/drurum.module b/sites/all/modules/custom/drurum/drurum.module index 172ce090..760cd1e8 100644 --- a/sites/all/modules/custom/drurum/drurum.module +++ b/sites/all/modules/custom/drurum/drurum.module @@ -462,30 +462,6 @@ function drurum_form_comment_node_blog_form_alter(&$form, &$form_state, $form_id hide($form['field_comment_upload']); } -/** - * Implements hook_views_api(). - */ -function drurum_views_api() { - return array( - 'api' => 3 - ); -} - -/** - * Implements hook_views_default_views(). - */ -function drurum_views_default_views() { - $files = file_scan_directory(drupal_get_path('module', 'drurum') . '/includes/views', '/.*\.view$/'); - foreach ($files as $filepath => $file) { - require $filepath; - if (isset($view)) { - $views[$view->name] = $view; - } - } - - return $views; -} - /** * Implements hook_form_BASE_FORM_ID_alter() for node_form(). */ diff --git a/sites/all/modules/custom/drurum/includes/fields/event--body.inc b/sites/all/modules/custom/drurum/includes/fields/event--body.inc new file mode 100644 index 00000000..41d05098 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--body.inc @@ -0,0 +1,50 @@ + $t('Description'), + 'widget' => array( + 'type' => 'text_textarea_with_summary', + 'settings' => array( + 'rows' => 20, + 'summary_rows' => 5, + ), + 'weight' => '46', + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'text_default', + 'settings' => array(), + 'weight' => 4, + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'settings' => array( + 'text_processing' => 1, + 'display_summary' => 0, + 'user_register_form' => FALSE, + ), + 'required' => FALSE, + 'description' => '', + 'field_name' => 'body', + 'entity_type' => 'node', + 'bundle' => 'event', + 'default_value' => NULL, +); +field_create_instance($instance); diff --git a/sites/all/modules/custom/drurum/includes/fields/event--field_event_address.inc b/sites/all/modules/custom/drurum/includes/fields/event--field_event_address.inc new file mode 100644 index 00000000..032d8ea3 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--field_event_address.inc @@ -0,0 +1,62 @@ + '0', + 'settings' => array( + 'max_length' => '255', + ), + 'field_name' => 'field_event_address', + 'type' => 'text', + 'active' => '1', + 'locked' => '0', + 'cardinality' => '1', +); +field_create_field($field); + +$instance = array( + 'label' => $t('Address'), + 'widget' => array( + 'weight' => '44', + 'type' => 'text_textfield', + 'active' => 1, + 'settings' => array( + 'size' => '60', + ), + ), + 'settings' => array( + 'text_processing' => '0', + 'user_register_form' => FALSE, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'text_default', + 'settings' => array(), + 'weight' => 3, + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'required' => 1, + 'description' => '', + 'default_value' => NULL, + 'field_name' => 'field_event_address', + 'entity_type' => 'node', + 'bundle' => 'event', +); +field_create_instance($instance); diff --git a/sites/all/modules/custom/drurum/includes/fields/event--field_event_date.inc b/sites/all/modules/custom/drurum/includes/fields/event--field_event_date.inc new file mode 100644 index 00000000..33022ef2 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--field_event_date.inc @@ -0,0 +1,89 @@ + '0', + 'settings' => array( + 'granularity' => array( + 'month' => 'month', + 'day' => 'day', + 'year' => 'year', + 'hour' => 0, + 'minute' => 0, + 'second' => 0, + ), + 'tz_handling' => 'none', + 'timezone_db' => '', + 'cache_enabled' => 0, + 'cache_count' => '4', + 'todate' => 'optional', + ), + 'field_name' => 'field_event_date', + 'type' => 'datetime', + 'active' => '1', + 'locked' => '0', + 'cardinality' => '1', +); +field_create_field($field); + +$instance = array( + 'label' => $t('Date'), + 'widget' => array( + 'weight' => '4', + 'type' => 'date_popup', + 'active' => 1, + 'settings' => array( + 'input_format' => 'site-wide', + 'input_format_custom' => '', + 'year_range' => '-10:+10', + 'increment' => '15', + 'label_position' => 'above', + 'text_parts' => array(), + 'no_fieldset' => 0, + ), + ), + 'settings' => array( + 'default_value' => 'now', + 'default_value_code' => '', + 'default_value2' => 'blank', + 'default_value_code2' => '', + 'user_register_form' => FALSE, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'date_default', + 'weight' => '1', + 'settings' => array( + 'format_type' => 'short', + 'fromto' => 'both', + 'multiple_number' => '', + 'multiple_from' => '', + 'multiple_to' => '', + 'show_remaining_days' => 0, + ), + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'required' => 1, + 'description' => '', + 'field_name' => 'field_event_date', + 'entity_type' => 'node', + 'bundle' => 'event', +); +field_create_instance($instance); \ No newline at end of file diff --git a/sites/all/modules/custom/drurum/includes/fields/event--field_event_image.inc b/sites/all/modules/custom/drurum/includes/fields/event--field_event_image.inc new file mode 100644 index 00000000..44267700 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--field_event_image.inc @@ -0,0 +1,73 @@ + '0', + 'settings' => array( + 'uri_scheme' => 'public', + 'default_image' => 0, + ), + 'field_name' => 'field_event_image', + 'type' => 'image', + 'active' => '1', + 'locked' => '0', + 'cardinality' => '1', +); +field_create_field($field); + +$instance = array( + 'label' => $t('Image'), + 'widget' => array( + 'weight' => '41', + 'type' => 'image_image', + 'active' => 1, + 'settings' => array( + 'progress_indicator' => 'throbber', + 'preview_image_style' => 'thumbnail', + ), + ), + 'settings' => array( + 'file_directory' => 'events_images', + 'file_extensions' => 'png gif jpg jpeg', + 'max_filesize' => '', + 'max_resolution' => '300x200', + 'min_resolution' => '300x200', + 'alt_field' => 0, + 'title_field' => 0, + 'default_image' => '54136', + 'user_register_form' => FALSE, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'image', + 'settings' => array( + 'image_style' => '', + 'image_link' => '', + ), + 'weight' => 0, + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'required' => 0, + 'description' => '', + 'field_name' => 'field_event_image', + 'entity_type' => 'node', + 'bundle' => 'event', +); +field_create_instance($instance); diff --git a/sites/all/modules/custom/drurum/includes/fields/event--field_event_link.inc b/sites/all/modules/custom/drurum/includes/fields/event--field_event_link.inc new file mode 100644 index 00000000..b07ac3a7 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--field_event_link.inc @@ -0,0 +1,92 @@ + '0', + 'settings' => array( + 'attributes' => array( + 'target' => 'default', + 'class' => '', + 'rel' => '', + ), + 'url' => 0, + 'title' => 'optional', + 'title_value' => '', + 'title_maxlength' => 128, + 'enable_tokens' => 1, + 'display' => array( + 'url_cutoff' => 80, + ), + ), + 'field_name' => 'field_event_link', + 'type' => 'link_field', + 'active' => '1', + 'locked' => '0', + 'cardinality' => '1', +); +field_create_field($field); + +$instance = array( + 'label' => $t('URL'), + 'widget' => array( + 'weight' => '5', + 'type' => 'link_field', + 'active' => 0, + 'settings' => array(), + ), + 'settings' => array( + 'absolute_url' => 1, + 'validate_url' => 1, + 'url' => 0, + 'title' => 'none', + 'title_value' => '', + 'title_allowed_values' => '', + 'title_label_use_field_label' => 0, + 'title_maxlength' => '128', + 'enable_tokens' => 1, + 'display' => array( + 'url_cutoff' => '80', + ), + 'attributes' => array( + 'target' => 'default', + 'rel' => '', + 'configurable_class' => 0, + 'class' => '', + 'configurable_title' => 0, + 'title' => '', + ), + 'rel_remove' => 'default', + 'user_register_form' => FALSE, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'link_url', + 'weight' => '2', + 'settings' => array(), + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'above', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'required' => 0, + 'description' => '', + 'default_value' => NULL, + 'field_name' => 'field_event_link', + 'entity_type' => 'node', + 'bundle' => 'event', +); +field_create_instance($instance); diff --git a/sites/all/modules/custom/drurum/includes/fields/event--field_event_type.inc b/sites/all/modules/custom/drurum/includes/fields/event--field_event_type.inc new file mode 100644 index 00000000..02599d93 --- /dev/null +++ b/sites/all/modules/custom/drurum/includes/fields/event--field_event_type.inc @@ -0,0 +1,64 @@ + '0', + 'settings' => array( + 'allowed_values' => array( + 0 => array( + 'vocabulary' => 'event_types', + 'parent' => '0', + ), + ), + ), + 'field_name' => 'field_event_type', + 'type' => 'taxonomy_term_reference', + 'active' => '1', + 'locked' => '0', + 'cardinality' => '1', +); +field_create_field($field); + +$instance = array( + 'label' => $t('Type'), + 'widget' => array( + 'weight' => '45', + 'type' => 'options_select', + 'active' => 1, + 'settings' => array(), + ), + 'settings' => array( + 'user_register_form' => FALSE, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'taxonomy_term_reference_link', + 'settings' => array(), + 'weight' => 4, + ), + 'teaser' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'frontpage' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + 'block' => array( + 'type' => 'hidden', + 'label' => 'hidden', + 'settings' => array(), + 'weight' => 0, + ), + ), + 'required' => 1, + 'description' => '', + 'default_value' => NULL, + 'field_name' => 'field_event_type', + 'entity_type' => 'node', + 'bundle' => 'event', +); +field_create_instance($instance); diff --git a/sites/all/modules/custom/drurum/includes/views/events-past-page.view b/sites/all/modules/custom/drurum/includes/views/events-past-page.inc similarity index 97% rename from sites/all/modules/custom/drurum/includes/views/events-past-page.view rename to sites/all/modules/custom/drurum/includes/views/events-past-page.inc index e43789c7..6288cd96 100644 --- a/sites/all/modules/custom/drurum/includes/views/events-past-page.view +++ b/sites/all/modules/custom/drurum/includes/views/events-past-page.inc @@ -36,7 +36,7 @@ $handler->display->display_options['fields']['field_event_image']['label'] = ''; $handler->display->display_options['fields']['field_event_image']['element_label_colon'] = FALSE; $handler->display->display_options['fields']['field_event_image']['click_sort_column'] = 'fid'; $handler->display->display_options['fields']['field_event_image']['settings'] = array( - 'image_style' => '', + 'image_style' => 'event_teaser', 'image_link' => 'content', ); /* Field: Content: Title */ @@ -67,10 +67,6 @@ $handler->display->display_options['fields']['body']['table'] = 'field_data_body $handler->display->display_options['fields']['body']['field'] = 'body'; $handler->display->display_options['fields']['body']['label'] = ''; $handler->display->display_options['fields']['body']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['body']['type'] = 'text_trimmed'; -$handler->display->display_options['fields']['body']['settings'] = array( - 'trim_length' => '150', -); /* Field: Content: Address */ $handler->display->display_options['fields']['field_event_address']['id'] = 'field_event_address'; $handler->display->display_options['fields']['field_event_address']['table'] = 'field_data_field_event_address'; @@ -137,3 +133,4 @@ $translatables['events_past'] = array( t('Desc'), t('There are no events in the near future'), ); +$view->save(); diff --git a/sites/all/modules/custom/drurum/includes/views/events-upcoming-block.view b/sites/all/modules/custom/drurum/includes/views/events-upcoming-block.inc similarity index 99% rename from sites/all/modules/custom/drurum/includes/views/events-upcoming-block.view rename to sites/all/modules/custom/drurum/includes/views/events-upcoming-block.inc index 4055aa0e..04f71efc 100644 --- a/sites/all/modules/custom/drurum/includes/views/events-upcoming-block.view +++ b/sites/all/modules/custom/drurum/includes/views/events-upcoming-block.inc @@ -36,7 +36,7 @@ $handler->display->display_options['fields']['field_event_image']['label'] = ''; $handler->display->display_options['fields']['field_event_image']['element_label_colon'] = FALSE; $handler->display->display_options['fields']['field_event_image']['click_sort_column'] = 'fid'; $handler->display->display_options['fields']['field_event_image']['settings'] = array( - 'image_style' => '', + 'image_style' => 'event_teaser', 'image_link' => 'content', ); /* Field: Content: Title */ @@ -112,3 +112,4 @@ $translatables['events'] = array( t('Block'), t('Upcoming events'), ); +$view->save(); diff --git a/sites/all/modules/custom/drurum/includes/views/events-upcoming-page.view b/sites/all/modules/custom/drurum/includes/views/events-upcoming-page.inc similarity index 97% rename from sites/all/modules/custom/drurum/includes/views/events-upcoming-page.view rename to sites/all/modules/custom/drurum/includes/views/events-upcoming-page.inc index 317903ea..12ddebe6 100644 --- a/sites/all/modules/custom/drurum/includes/views/events-upcoming-page.view +++ b/sites/all/modules/custom/drurum/includes/views/events-upcoming-page.inc @@ -36,7 +36,7 @@ $handler->display->display_options['fields']['field_event_image']['label'] = ''; $handler->display->display_options['fields']['field_event_image']['element_label_colon'] = FALSE; $handler->display->display_options['fields']['field_event_image']['click_sort_column'] = 'fid'; $handler->display->display_options['fields']['field_event_image']['settings'] = array( - 'image_style' => '', + 'image_style' => 'event_teaser', 'image_link' => 'content', ); /* Field: Content: Title */ @@ -67,10 +67,6 @@ $handler->display->display_options['fields']['body']['table'] = 'field_data_body $handler->display->display_options['fields']['body']['field'] = 'body'; $handler->display->display_options['fields']['body']['label'] = ''; $handler->display->display_options['fields']['body']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['body']['type'] = 'text_trimmed'; -$handler->display->display_options['fields']['body']['settings'] = array( - 'trim_length' => '150', -); /* Field: Content: Address */ $handler->display->display_options['fields']['field_event_address']['id'] = 'field_event_address'; $handler->display->display_options['fields']['field_event_address']['table'] = 'field_data_field_event_address'; @@ -141,3 +137,4 @@ $translatables['events_upcoming'] = array( t('There are no events in the near future'), t('Upcoming events'), ); +$view->save();