Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: fallback
label: 'Fallback date format'
status: true
langcode: en
locked: true
pattern: 'D, m/d/Y - H:i'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_date
label: 'HTML Date'
status: true
langcode: en
locked: true
pattern: Y-m-d

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_datetime
label: 'HTML Datetime'
status: true
langcode: en
locked: true
pattern: 'Y-m-d\TH:i:sO'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_month
label: 'HTML Month'
status: true
langcode: en
locked: true
pattern: Y-m

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_time
label: 'HTML Time'
status: true
langcode: en
locked: true
pattern: 'H:i:s'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_week
label: 'HTML Week'
status: true
langcode: en
locked: true
pattern: Y-\WW

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_year
label: 'HTML Year'
status: true
langcode: en
locked: true
pattern: Y
pattern: 'Y'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: html_yearless_date
label: 'HTML Yearless date'
status: true
langcode: en
locked: true
pattern: m-d

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: long
label: 'Default long date'
status: true
langcode: en
locked: false
pattern: 'l, F j, Y - H:i'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: medium
label: 'Default medium date'
status: true
langcode: en
locked: false
pattern: 'D, m/d/Y - H:i'

View file

@ -1,6 +1,7 @@
langcode: en
status: true
dependencies: { }
id: short
label: 'Default short date'
status: true
langcode: en
locked: false
pattern: 'm/d/Y - H:i'

View file

@ -1,4 +1,3 @@
threshold:
autorun: 0
requirements_warning: 172800
requirements_error: 1209600

View file

@ -1,5 +1,7 @@
langcode: en
status: true
dependencies: { }
id: account
label: 'User account menu'
description: 'Links related to the user account.'
langcode: en
description: 'Links related to the active user account'
locked: true

View file

@ -1,5 +1,7 @@
langcode: en
status: true
dependencies: { }
id: admin
label: Administration
description: 'Contains links to administrative tasks.'
langcode: en
description: 'Administrative task links'
locked: true

View file

@ -1,5 +1,7 @@
langcode: en
status: true
dependencies: { }
id: footer
label: Footer
description: 'Use this for linking to site information.'
langcode: en
description: 'Site information links'
locked: true

View file

@ -1,5 +1,7 @@
langcode: en
status: true
dependencies: { }
id: main
label: 'Main navigation'
description: 'Use this for linking to the main site sections.'
langcode: en
description: 'Site section links'
locked: true

View file

@ -1,5 +1,7 @@
langcode: en
status: true
dependencies: { }
id: tools
label: Tools
description: 'Contains links for site visitors. Some modules add their links here.'
langcode: en
description: 'User tool links, often added by modules'
locked: true

View file

@ -7,10 +7,7 @@ features:
comment_user_picture: true
comment_user_verification: true
favicon: true
logo: true
name: true
node_user_picture: true
slogan: true
logo:
path: ''
url: ''

View file

@ -66,9 +66,6 @@ system.cron:
type: mapping
label: 'Thresholds'
mapping:
autorun:
type: integer
label: 'Run cron every'
requirements_warning:
type: integer
label: 'Requirements warning period'

View file

@ -1,43 +0,0 @@
/**
* @file
* Styles for link buttons and action links.
*/
.action-links {
list-style: none;
padding: 0;
margin: 1em 0;
}
[dir="rtl"] .action-links {
/* This is required to win over specificity of [dir="rtl"] ul */
margin-right: 0;
}
.action-links li {
display: inline-block;
margin: 0 0.3em;
}
.action-links li:first-child {
margin-left: 0; /* LTR */
}
[dir="rtl"] .action-links li:first-child {
margin-left: 0.3em;
margin-right: 0;
}
.button-action {
display: inline-block;
line-height: 160%;
padding: 0.2em 0.5em 0.3em;
text-decoration: none;
}
.button-action:before {
content: '+';
font-weight: 900;
margin-left: -0.1em; /* LTR */
padding-right: 0.2em; /* LTR */
}
[dir="rtl"] .button-action:before {
margin-left: 0;
margin-right: -0.1em;
padding-left: 0.2em;
padding-right: 0;
}

View file

@ -29,7 +29,7 @@ tr .ajax-progress-throbber .throbber {
/* Full screen throbber */
.ajax-progress-fullscreen {
/* Can't do center:50% middle: 50%, so approximate it for a typical window size. */
left: 49%;
left: 49%; /* LTR */
position: fixed;
top: 48.5%;
z-index: 1000;
@ -43,3 +43,7 @@ tr .ajax-progress-throbber .throbber {
padding: 4px;
width: 24px;
}
[dir="rtl"] .ajax-progress-fullscreen {
left: auto;
right: 49%;
}

View file

@ -1,29 +0,0 @@
/**
* @file
* Styles for breadcrumbs.
*/
.breadcrumb {
padding-bottom: 0.5em;
}
.breadcrumb ol {
margin: 0;
padding: 0;
}
[dir="rtl"] .breadcrumb ol {
/* This is required to win over specificity of [dir="rtl"] ol */
margin-right: 0;
}
.breadcrumb li {
display: inline;
list-style-type: none;
margin: 0;
padding: 0;
}
/* IE8 does not support :not() and :last-child. */
.breadcrumb li:before {
content: ' \BB ';
}
.breadcrumb li:first-child:before {
content: none;
}

View file

@ -1,15 +0,0 @@
/**
* @file
* Visual styles for buttons.
*/
.button,
.image-button {
margin-left: 1em;
margin-right: 1em;
}
.button:first-child,
.image-button:first-child {
margin-left: 0;
margin-right: 0;
}

View file

@ -1,32 +0,0 @@
/**
* @file
* Visual styles for collapsible fieldsets.
*/
.collapse-processed > summary {
padding-left: 0.5em;
padding-right: 0.5em;
}
.collapse-processed > summary:before {
background: url(../../../../misc/menu-expanded.png) 0px 100% no-repeat; /* LTR */
content: "";
float: left;
height: 1em;
width: 1em;
}
[dir="rtl"] .collapse-processed > summary:before {
background-position: 100% 100%;
float: right;
}
.collapse-processed:not([open]) > summary:before {
background-position: 25% 35%; /* LTR */
-ms-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
}
[dir="rtl"] .collapse-processed:not([open]) > summary:before {
background-position: 75% 35%;
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}

View file

@ -1,20 +0,0 @@
/**
* @file
* Inline items.
*/
.container-inline label:after,
.container-inline .label:after {
content: ':';
}
.form-type-radios .container-inline label:after {
content: '';
}
.form-type-radios .container-inline .form-type-radio {
margin: 0 1em;
}
.container-inline .form-actions,
.container-inline.form-actions {
margin-top: 0;
margin-bottom: 0;
}

View file

@ -1,23 +0,0 @@
/**
* @file
* Collapsible details.
*
* @see collapse.js
* @see http://nicolasgallagher.com/css-background-image-hacks/
*/
details {
border: 1px solid #ccc;
margin-top: 1em;
margin-bottom: 1em;
}
details > .details-wrapper {
padding: 0.5em 1.5em;
}
/* @todo Regression: The summary of uncollapsible details are no longer
vertically aligned with the .details-wrapper in browsers without native
details support. */
summary {
cursor: pointer;
padding: 0.2em 0.5em;
}

View file

@ -1,46 +0,0 @@
/**
* @file
* Visual styles for exposed filters.
*/
.exposed-filters .filters {
float: left; /* LTR */
margin-right: 1em; /* LTR */
}
[dir="rtl"] .exposed-filters .filters {
float: right;
margin-left: 1em;
margin-right: 0;
}
.exposed-filters .form-item {
margin: 0 0 0.1em 0;
padding: 0;
}
.exposed-filters .form-item label {
float: left; /* LTR */
font-weight: normal;
width: 10em;
}
[dir="rtl"] .exposed-filters .form-item label {
float: right;
}
.exposed-filters .form-select {
width: 14em;
}
/* Current filters */
.exposed-filters .current-filters {
margin-bottom: 1em;
}
.exposed-filters .current-filters .placeholder {
font-style: normal;
font-weight: bold;
}
.exposed-filters .additional-filters {
float: left; /* LTR */
margin-right: 1em; /* LTR */
}
[dir="rtl"] .exposed-filters .additional-filters {
float: right;
margin-left: 1em;
margin-right: 0;
}

View file

@ -1,25 +0,0 @@
/**
* @file
* Visual styles for fields.
*/
.field__label {
font-weight: bold;
}
.field--label-inline .field__label,
.field--label-inline .field__items {
float: left; /*LTR*/
}
.field--label-inline .field__label,
.field--label-inline > .field__item,
.field--label-inline .field__items {
padding-right: 0.5em;
}
[dir="rtl"] .field--label-inline .field__label,
[dir="rtl"] .field--label-inline .field__items {
padding-left: 0.5em;
padding-right: 0;
}
.field--label-inline .field__label::after {
content: ':';
}

View file

@ -1,98 +0,0 @@
/**
* @file
* Visual styles for form components.
*/
form .field-multiple-table {
margin: 0;
}
form .field-multiple-table .field-multiple-drag {
width: 30px;
padding-right: 0; /*LTR*/
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag {
padding-left: 0;
}
form .field-multiple-table .field-multiple-drag .tabledrag-handle {
padding-right: .5em; /*LTR*/
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag .tabledrag-handle {
padding-left: .5em;
}
form .field-add-more-submit {
margin: .5em 0 0;
}
/**
* Markup generated by Form API.
*/
.form-item,
.form-actions {
margin-top: 1em;
margin-bottom: 1em;
}
tr.odd .form-item,
tr.even .form-item {
margin-top: 0;
margin-bottom: 0;
}
.form-composite > .fieldset-wrapper > .description,
.form-item .description {
font-size: 0.85em;
}
label.option {
display: inline;
font-weight: normal;
}
.form-composite > legend,
.label {
display:inline;
font-size: inherit;
font-weight: bold;
margin: 0;
padding: 0;
}
.form-checkboxes .form-item,
.form-radios .form-item {
margin-top: 0.4em;
margin-bottom: 0.4em;
}
.form-type-radio .description,
.form-type-checkbox .description {
margin-left: 2.4em;
}
.marker {
color: #e00;
}
.form-required:after {
content: '';
vertical-align: super;
display: inline-block;
/* Use a background image to prevent screen readers from announcing the text. */
background-image: url(../../../../misc/icons/ee0000/required.svg);
background-repeat: no-repeat;
background-size: 6px 6px;
width: 6px;
height: 6px;
margin: 0 0.3em;
}
abbr.tabledrag-changed,
abbr.ajax-changed {
border-bottom: none;
}
.form-item input.error,
.form-item textarea.error,
.form-item select.error {
border: 2px solid red;
}
/* Inline error messages. */
.form-item--error-message:before {
content: '';
display: inline-block;
height: 14px;
width: 14px;
vertical-align: sub;
background: url(../../../../misc/icons/e32700/error.svg) no-repeat;
background-size: contain;
}

View file

@ -1,21 +0,0 @@
/**
* @file
* Visual styles for icons.
*/
.icon-help {
background: url(../../../../misc/help.png) 0 50% no-repeat; /* LTR */
padding: 1px 0 1px 20px; /* LTR */
}
[dir="rtl"] .icon-help {
background-position: 100% 50%;
padding: 1px 20px 1px 0;
}
.feed-icon {
background: url(../../../../misc/feed.svg) no-repeat;
overflow: hidden;
text-indent: -9999px;
display: block;
width: 16px;
height: 16px;
}

View file

@ -1,29 +0,0 @@
/**
* @file
* Visual styles for inline forms.
*/
.form--inline .form-item {
float: left; /* LTR */
margin-right: 0.5em; /* LTR */
}
[dir="rtl"] .form--inline .form-item {
float: right;
margin-right: 0;
margin-left: 0.5em;
}
.form--inline .form-item-separator {
margin-top: 2.3em;
margin-right: 1em; /* LTR */
margin-left: 0.5em; /* LTR */
}
[dir="rtl"] .form--inline .form-item-separator {
margin-right: 0.5em;
margin-left: 1em;
}
.form--inline .form-actions {
clear: left; /* LTR */
}
[dir="rtl"] .form--inline .form-actions {
clear: right;
}

View file

@ -0,0 +1,19 @@
/**
* @file
* Styles for item list.
*/
.item-list__comma-list,
.item-list__comma-list li {
display: inline;
}
.item-list__comma-list {
margin: 0;
padding: 0;
}
.item-list__comma-list li:after {
content: ", ";
}
.item-list__comma-list li:last-child:after {
content: "";
}

View file

@ -1,39 +0,0 @@
/**
* @file
* Visual styles for item list.
*/
.item-list .title {
font-weight: bold;
}
.item-list ul {
margin: 0 0 0.75em 0;
padding: 0;
}
.item-list ul li {
margin: 0 0 0.25em 1.5em; /* LTR */
padding: 0;
}
[dir="rtl"] .item-list ul li {
margin: 0 1.5em 0.25em 0;
}
ul.item-list__comma-list {
display: inline;
}
ul.item-list__comma-list li {
display: inline;
list-style-type: none;
}
ul.item-list__comma-list,
ul.item-list__comma-list li,
[dir="rtl"] ul.item-list__comma-list,
[dir="rtl"] ul.item-list__comma-list li {
margin: 0;
padding: 0;
}
ul.item-list__comma-list li:after {
content: ", ";
}
ul.item-list__comma-list li:last-child:after {
content: "";
}

View file

@ -1,16 +0,0 @@
/**
* @file
* Style another element as a link.
*/
button.link {
background: transparent;
border: 0;
cursor: pointer;
margin: 0;
padding: 0;
font-size: 1em;
}
label button.link {
font-weight: bold;
}

View file

@ -1,18 +0,0 @@
/**
* @file
* Visual styles for links.
*/
ul.inline,
ul.links.inline {
display: inline;
padding-left: 0;
}
ul.inline li {
display: inline;
list-style-type: none;
padding: 0 0.5em;
}
ul.links a.is-active {
color: #000;
}

View file

@ -1,34 +0,0 @@
/**
* @file
* Visual styles for menu.
*/
ul.menu {
list-style: none outside;
margin-left: 1em; /* LTR */
padding: 0;
text-align: left; /* LTR */
}
[dir="rtl"] ul.menu {
margin-left: 0;
margin-right: 1em;
text-align: right;
}
.menu-item--expanded {
list-style-image: url(../../../../misc/menu-expanded.png);
list-style-type: circle;
}
.menu-item--collapsed {
list-style-image: url(../../../../misc/menu-collapsed.png); /* LTR */
list-style-type: disc;
}
[dir="rtl"] .menu-item--collapsed {
list-style-image: url(../../../../misc/menu-collapsed-rtl.png);
}
.menu-item {
padding-top: 0.2em;
margin: 0;
}
ul.menu a.is-active {
color: #000;
}

View file

@ -1,72 +0,0 @@
/**
* @file
* Styles for system messages.
*/
.messages {
background: no-repeat 10px 17px; /* LTR */
border: 1px solid;
border-width: 1px 1px 1px 0; /* LTR */
border-radius: 2px;
padding: 15px 20px 15px 35px; /* LTR */
word-wrap: break-word;
overflow-wrap: break-word;
}
[dir="rtl"] .messages {
border-width: 1px 0 1px 1px;
background-position: right 10px top 17px;
padding-left: 20px;
padding-right: 35px;
text-align: right;
}
.messages + .messages {
margin-top: 1.538em;
}
.messages__list {
list-style: none;
padding: 0;
margin: 0;
}
.messages__item + .messages__item {
margin-top: 0.769em;
}
/* See .color-success in Seven's colors.css */
.messages--status {
color: #325e1c;
background-color: #f3faef;
border-color: #c9e1bd #c9e1bd #c9e1bd transparent; /* LTR */
background-image: url(../../../../misc/icons/73b355/check.svg);
box-shadow: -8px 0 0 #77b259; /* LTR */
}
[dir="rtl"] .messages--status {
border-color: #c9e1bd transparent #c9e1bd #c9e1bd;
box-shadow: 8px 0 0 #77b259;
margin-left: 0;
}
/* See .color-warning in Seven's colors.css */
.messages--warning {
background-color: #fdf8ed;
background-image: url(../../../../misc/icons/e29700/warning.svg);
border-color: #f4daa6 #f4daa6 #f4daa6 transparent; /* LTR */
color: #734c00;
box-shadow: -8px 0 0 #e09600; /* LTR */
}
[dir="rtl"] .messages--warning {
border-color: #f4daa6 transparent #f4daa6 #f4daa6;
box-shadow: 8px 0 0 #e09600;
}
/* See .color-error in Seven's colors.css */
.messages--error {
background-color: #fcf4f2;
color: #a51b00;
background-image: url(../../../../misc/icons/e32700/error.svg);
border-color: #f9c9bf #f9c9bf #f9c9bf transparent; /* LTR */
box-shadow: -8px 0 0 #e62600; /* LTR */
}
[dir="rtl"] .messages--error {
border-color: #f9c9bf transparent #f9c9bf #f9c9bf;
box-shadow: 8px 0 0 #e62600;
}
.messages--error p.error {
color: #a51b00;
}

View file

@ -1,12 +0,0 @@
/**
* @file
* Markup generated by #type 'more_link'.
*/
.more-link {
display: block;
text-align: right; /* LTR */
}
[dir="rtl"] .more-link {
text-align: left;
}

View file

@ -1,16 +0,0 @@
/**
* @file
* Visual styles for pager.
*/
.pager__items {
clear: both;
text-align: center;
}
.pager__item {
display: inline;
padding: 0.5em;
}
.pager__item.is-active {
font-weight: bold;
}

View file

@ -19,6 +19,7 @@
.progress__bar {
background-color: #000;
height: 1.5em;
width: 3%;
min-width: 3%;
max-width: 100%;
}

View file

@ -1,64 +0,0 @@
/**
* @file
* Visual styles for progress bar.
*
* @see progress.js
*/
.progress__track {
border-color: #b3b3b3;
border-radius: 10em;
background-color: #f2f1eb;
background-image: -webkit-linear-gradient(#e7e7df, #f0f0f0);
background-image: linear-gradient(#e7e7df, #f0f0f0);
box-shadow: inset 0 1px 3px hsla(0, 0%, 0%, 0.16);
}
.progress__bar {
border: 1px #07629a solid;
background: #057ec9;
background-image:
-webkit-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
-webkit-linear-gradient( left top,
#0094f0 0%,
#0094f0 25%,
#007ecc 25%,
#007ecc 50%,
#0094f0 50%,
#0094f0 75%,
#0094f0 100% );
background-image:
-webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)), -webkit-linear-gradient(left top, #0094f0 0%, #0094f0 25%, #007ecc 25%, #007ecc 50%, #0094f0 50%, #0094f0 75%, #0094f0 100%);
background-image:
linear-gradient( to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
linear-gradient( to right bottom,
#0094f0 0%,
#0094f0 25%,
#007ecc 25%,
#007ecc 50%,
#0094f0 50%,
#0094f0 75%,
#0094f0 100% );
background-size: 40px 40px;
margin-top: -1px;
margin-left: -1px;
padding: 0 1px;
height: 16px;
border-radius: 10em;
-webkit-animation: animate-stripes 3s linear infinite;
-moz-animation: animate-stripes 3s linear infinite;
-webkit-transition: width 0.5s ease-out;
transition: width 0.5s ease-out;
}
/**
* Progress bar animations.
*/
@-webkit-keyframes animate-stripes {
0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
}
@-ms-keyframes animate-stripes {
0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
}
@keyframes animate-stripes {
0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;}
}

View file

@ -59,9 +59,12 @@ a.tabledrag-handle:focus .handle {
width: 40px;
}
.touch a.tabledrag-handle .handle {
background-position: 40% 19px;
background-position: 40% 19px; /* LTR */
height: 21px;
}
[dir="rtl"] .touch a.tabledrag-handle .handle {
background-position: right 40% top 19px;
}
.touch .draggable.drag a.tabledrag-handle .handle {
background-position: 50% -32px;
}

View file

@ -1,14 +0,0 @@
/**
* @file
* Visual styles for table drag.
*/
tr.drag {
background-color: #fffff0;
}
tr.drag-previous {
background-color: #ffd;
}
body div.tabledrag-changed-warning {
margin-bottom: 0.5em;
}

View file

@ -1,14 +0,0 @@
/**
* @file
* Table select behavior.
*
* @see tableselect.js
*/
tr.selected td {
background: #ffc;
}
td.checkbox,
th.checkbox {
text-align: center;
}

View file

@ -0,0 +1,19 @@
/**
* @file
* Table sort indicator.
*
* @see tablesort-indicator.html.twig
*/
.tablesort {
width: 16px;
height: 16px;
display: inline-block;
background-size: 100%;
}
.tablesort--asc {
background-image: url(../../../../misc/icons/787878/twistie-down.svg);
}
.tablesort--desc {
background-image: url(../../../../misc/icons/787878/twistie-up.svg);
}

View file

@ -1,11 +0,0 @@
/**
* @file
* Table sort indicator.
*/
th.is-active img {
display: inline;
}
td.is-active {
background-color: #ddd;
}

View file

@ -1,33 +0,0 @@
/**
* @file
* Visual styles for tabs.
*/
div.tabs {
margin: 1em 0;
}
ul.tabs {
list-style: none;
margin: 0 0 0.5em;
padding: 0;
}
.tabs > li {
display: inline-block;
margin-right: 0.3em; /* LTR */
}
[dir="rtl"] .tabs > li {
margin-left: 0.3em;
margin-right: 0;
}
.tabs a {
display: block;
padding: 0.2em 1em;
text-decoration: none;
}
.tabs a.is-active {
background-color: #eee;
}
.tabs a:focus,
.tabs a:hover {
background-color: #f5f5f5;
}

View file

@ -1,11 +0,0 @@
/**
* @file
* Visual styles for a resizable textarea.
*/
.form-textarea-wrapper textarea {
display: block;
margin: 0;
width: 100%;
box-sizing: border-box;
}

View file

@ -33,13 +33,13 @@
padding-right: 10px;
padding-left: 0;
}
.layout-column.half {
.layout-column--half {
width: 50%;
}
.layout-column.quarter {
.layout-column--quarter {
width: 25%;
}
.layout-column.three-quarter {
.layout-column--three-quarter {
width: 75%;
}
}
@ -132,7 +132,11 @@ small .admin-link:after {
cursor: default;
}
.system-modules td {
padding-left: 0;
padding-left: 0; /* LTR */
}
[dir="rtl"] .system-modules td {
padding-left: 12px;
padding-right: 0;
}
@media screen and (max-width: 40em) {
@ -188,24 +192,30 @@ small .admin-link:after {
}
/* Status report. */
.system-status-report td {
.system-status-report__status-title {
position: relative;
vertical-align: top;
width: 25%;
padding: 10px 6px 10px 40px; /* LTR */
box-sizing: border-box;
font-weight: normal;
}
.system-status-report__status-icon {
width: 16px;
padding-right: 0; /* LTR */
}
[dir="rtl"] .system-status-report__status-icon {
padding-left: 0;
padding-right: 6px;
[dir="rtl"] .system-status-report__status-title {
padding: 10px 40px 10px 6px;
}
.system-status-report__status-icon:before {
content: "";
background-repeat: no-repeat;
height: 16px;
width: 16px;
margin-top: 2px;
display: block;
position: absolute;
left: 12px; /* LTR */
top: 12px;
}
[dir="rtl"] .system-status-report__status-icon:before {
left: auto;
right: 12px;
}
.system-status-report__status-icon--error:before {
background-image: url(../../../misc/icons/e32700/error.svg);
@ -213,9 +223,6 @@ small .admin-link:after {
.system-status-report__status-icon--warning:before {
background-image: url(../../../misc/icons/e29700/warning.svg);
}
.system-status-report__status-title {
width: 25%;
}
/**
* Appearance page.
@ -366,5 +373,8 @@ small .admin-link:after {
padding: 0 0 0 0.7em;
}
.system-themes-admin-form {
clear: left;
clear: left; /* LTR */
}
[dir="rtl"] .system-themes-admin-form {
clear: right;
}

View file

@ -26,7 +26,11 @@ table.diff .diff-marker {
width: 1.4em;
}
table.diff th {
padding-right: inherit;
padding-right: inherit; /* LTR */
}
[dir="rtl"] table.diff th {
padding-right: 0;
padding-left: inherit;
}
table.diff td div {
overflow: auto;

View file

@ -41,7 +41,11 @@
}
#edit-connection-settings-change-connection-type {
margin: 2.6em 0.5em 0 1em;
margin: 2.6em 0.5em 0 1em; /* LTR */
}
[dir="rtl"] #edit-connection-settings-change-connection-type {
margin-left: 0.5em;
margin-right: 1em;
}
/**

View file

@ -1,5 +1,5 @@
id: d6_date_formats
label: Drupal 6 date format configuration
label: Date format configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_cron
label: Drupal 6 cron settings
label: Cron settings
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_date
label: Drupal 6 system date configuration
label: System date configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_file
label: Drupal 6 file system configuration
label: File system configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_image
label: Drupal 6 image toolkit configuration
label: Image toolkit configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_image_gd
label: Drupal 6 image quality configuration
label: Image quality configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_logging
label: Drupal 6 system logging
label: System logging
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_maintenance
label: Drupal 6 maintenance page configuration
label: Maintenance page configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_performance
label: Drupal 6 performance configuration
label: Performance configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_rss
label: Drupal 6 RSS configuration
label: RSS configuration
migration_tags:
- Drupal 6
source:

View file

@ -1,5 +1,5 @@
id: d6_system_site
label: Drupal 6 site configuration
label: Site configuration
migration_tags:
- Drupal 6
source:

View file

@ -15,6 +15,7 @@ use Drupal\Core\Render\BareHtmlPageRendererInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\State\StateInterface;
use Drupal\Core\Update\UpdateRegistry;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
@ -74,6 +75,13 @@ class DbUpdateController extends ControllerBase {
*/
protected $root;
/**
* The post update registry.
*
* @var \Drupal\Core\Update\UpdateRegistry
*/
protected $postUpdateRegistry;
/**
* Constructs a new UpdateController.
*
@ -91,8 +99,10 @@ class DbUpdateController extends ControllerBase {
* The current user.
* @param \Drupal\Core\Render\BareHtmlPageRendererInterface $bare_html_page_renderer
* The bare HTML page renderer.
* @param \Drupal\Core\Update\UpdateRegistry $post_update_registry
* The post update registry.
*/
public function __construct($root, KeyValueExpirableFactoryInterface $key_value_expirable_factory, CacheBackendInterface $cache, StateInterface $state, ModuleHandlerInterface $module_handler, AccountInterface $account, BareHtmlPageRendererInterface $bare_html_page_renderer) {
public function __construct($root, KeyValueExpirableFactoryInterface $key_value_expirable_factory, CacheBackendInterface $cache, StateInterface $state, ModuleHandlerInterface $module_handler, AccountInterface $account, BareHtmlPageRendererInterface $bare_html_page_renderer, UpdateRegistry $post_update_registry) {
$this->root = $root;
$this->keyValueExpirableFactory = $key_value_expirable_factory;
$this->cache = $cache;
@ -100,6 +110,7 @@ class DbUpdateController extends ControllerBase {
$this->moduleHandler = $module_handler;
$this->account = $account;
$this->bareHtmlPageRenderer = $bare_html_page_renderer;
$this->postUpdateRegistry = $post_update_registry;
}
/**
@ -113,7 +124,8 @@ class DbUpdateController extends ControllerBase {
$container->get('state'),
$container->get('module_handler'),
$container->get('current_user'),
$container->get('bare_html_page_renderer')
$container->get('bare_html_page_renderer'),
$container->get('update.post_update_registry')
);
}
@ -210,8 +222,8 @@ class DbUpdateController extends ControllerBase {
);
$info[] = $this->t("<strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.");
$info[] = $this->t('Put your site into <a href="@url">maintenance mode</a>.', array(
'@url' => Url::fromRoute('system.site_maintenance_mode')->toString(TRUE)->getGeneratedUrl(),
$info[] = $this->t('Put your site into <a href=":url">maintenance mode</a>.', array(
':url' => Url::fromRoute('system.site_maintenance_mode')->toString(TRUE)->getGeneratedUrl(),
));
$info[] = $this->t('<strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.');
$info[] = $this->t('Install your new files in the appropriate location, as described in the handbook.');
@ -257,35 +269,52 @@ class DbUpdateController extends ControllerBase {
// Ensure system.module's updates appear first.
$build['start']['system'] = array();
$updates = update_get_update_list();
$starting_updates = array();
$incompatible_updates_exist = FALSE;
foreach ($updates as $module => $update) {
if (!isset($update['start'])) {
$build['start'][$module] = array(
'#type' => 'item',
'#title' => $module . ' module',
'#markup' => $update['warning'],
'#prefix' => '<div class="messages messages--warning">',
'#suffix' => '</div>',
);
$incompatible_updates_exist = TRUE;
continue;
$updates_per_module = [];
foreach (['update', 'post_update'] as $update_type) {
switch ($update_type) {
case 'update':
$updates = update_get_update_list();
break;
case 'post_update':
$updates = $this->postUpdateRegistry->getPendingUpdateInformation();
break;
}
if (!empty($update['pending'])) {
$starting_updates[$module] = $update['start'];
$build['start'][$module] = array(
'#type' => 'hidden',
'#value' => $update['start'],
);
$build['start'][$module . '_updates'] = array(
'#theme' => 'item_list',
'#items' => $update['pending'],
'#title' => $module . ' module',
);
}
if (isset($update['pending'])) {
$count = $count + count($update['pending']);
foreach ($updates as $module => $update) {
if (!isset($update['start'])) {
$build['start'][$module] = array(
'#type' => 'item',
'#title' => $module . ' module',
'#markup' => $update['warning'],
'#prefix' => '<div class="messages messages--warning">',
'#suffix' => '</div>',
);
$incompatible_updates_exist = TRUE;
continue;
}
if (!empty($update['pending'])) {
$updates_per_module += [$module => []];
$updates_per_module[$module] = array_merge($updates_per_module[$module], $update['pending']);
$build['start'][$module] = array(
'#type' => 'hidden',
'#value' => $update['start'],
);
// Store the previous items in order to merge normal updates and
// post_update functions together.
$build['start'][$module] = array(
'#theme' => 'item_list',
'#items' => $updates_per_module[$module],
'#title' => $module . ' module',
);
if ($update_type === 'update') {
$starting_updates[$module] = $update['start'];
}
}
if (isset($update['pending'])) {
$count = $count + count($update['pending']);
}
}
}
@ -372,8 +401,8 @@ class DbUpdateController extends ControllerBase {
// Report end result.
$dblog_exists = $this->moduleHandler->moduleExists('dblog');
if ($dblog_exists && $this->account->hasPermission('access site reports')) {
$log_message = $this->t('All errors have been <a href="@url">logged</a>.', array(
'@url' => Url::fromRoute('dblog.overview')->setOption('base_url', $base_url)->toString(TRUE)->getGeneratedUrl(),
$log_message = $this->t('All errors have been <a href=":url">logged</a>.', array(
':url' => Url::fromRoute('dblog.overview')->setOption('base_url', $base_url)->toString(TRUE)->getGeneratedUrl(),
));
}
else {
@ -381,7 +410,7 @@ class DbUpdateController extends ControllerBase {
}
if (!empty($_SESSION['update_success'])) {
$message = '<p>' . $this->t('Updates were attempted. If you see no failures below, you may proceed happily back to your <a href="@url">site</a>. Otherwise, you may need to update your database manually.', array('@url' => Url::fromRoute('<front>')->setOption('base_url', $base_url)->toString(TRUE)->getGeneratedUrl())) . ' ' . $log_message . '</p>';
$message = '<p>' . $this->t('Updates were attempted. If you see no failures below, you may proceed happily back to your <a href=":url">site</a>. Otherwise, you may need to update your database manually.', array(':url' => Url::fromRoute('<front>')->setOption('base_url', $base_url)->toString(TRUE)->getGeneratedUrl())) . ' ' . $log_message . '</p>';
}
else {
$last = reset($_SESSION['updates_remaining']);
@ -415,7 +444,7 @@ class DbUpdateController extends ControllerBase {
if ($module != '#abort') {
$module_has_message = FALSE;
$info_messages = array();
foreach ($updates as $number => $queries) {
foreach ($updates as $name => $queries) {
$messages = array();
foreach ($queries as $query) {
// If there is no message for this update, don't show anything.
@ -439,10 +468,16 @@ class DbUpdateController extends ControllerBase {
if ($messages) {
$module_has_message = TRUE;
if (is_numeric($name)) {
$title = $this->t('Update #@count', ['@count' => $name]);
}
else {
$title = $this->t('Update @name', ['@name' => trim($name, '_')]);
}
$info_messages[] = array(
'#theme' => 'item_list',
'#items' => $messages,
'#title' => $this->t('Update #@count', array('@count' => $number)),
'#title' => $title,
);
}
}
@ -493,7 +528,7 @@ class DbUpdateController extends ControllerBase {
$build['status_report'] = array(
'#theme' => 'status_report',
'#requirements' => $requirements,
'#suffix' => $this->t('Check the messages and <a href="@url">try again</a>.', array('@url' => $try_again_url))
'#suffix' => $this->t('Check the messages and <a href=":url">try again</a>.', array(':url' => $try_again_url))
);
$build['#title'] = $this->t('Requirements problem');
@ -575,6 +610,17 @@ class DbUpdateController extends ControllerBase {
}
}
$post_updates = $this->postUpdateRegistry->getPendingUpdateFunctions();
if ($post_updates) {
// Now we rebuild all caches and after that execute the hook_post_update()
// functions.
$operations[] = ['drupal_flush_all_caches', []];
foreach ($post_updates as $function) {
$operations[] = ['update_invoke_post_update', [$function]];
}
}
$batch['operations'] = $operations;
$batch += array(
'title' => $this->t('Updating'),

View file

@ -118,7 +118,7 @@ class SystemController extends ControllerBase {
public function overview($link_id) {
// Check for status report errors.
if ($this->systemManager->checkRequirements() && $this->currentUser()->hasPermission('administer site configuration')) {
drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => $this->url('system.status'))), 'error');
drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the <a href=":status">status report</a> for more information.', array(':status' => $this->url('system.status'))), 'error');
}
// Load all menu links below it.
$parameters = new MenuTreeParameters();
@ -231,8 +231,8 @@ class SystemController extends ControllerBase {
if (isset($themes[$theme_key]) && file_exists($themes[$theme_key]->info['screenshot'])) {
$theme->screenshot = array(
'uri' => $themes[$theme_key]->info['screenshot'],
'alt' => $this->t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])),
'title' => $this->t('Screenshot for !theme theme', array('!theme' => $theme->info['name'])),
'alt' => $this->t('Screenshot for @theme theme', array('@theme' => $theme->info['name'])),
'title' => $this->t('Screenshot for @theme theme', array('@theme' => $theme->info['name'])),
'attributes' => array('class' => array('screenshot')),
);
break;
@ -259,7 +259,7 @@ class SystemController extends ControllerBase {
$theme->operations[] = array(
'title' => $this->t('Settings'),
'url' => Url::fromRoute('system.theme_settings_theme', ['theme' => $theme->getName()]),
'attributes' => array('title' => $this->t('Settings for !theme theme', array('!theme' => $theme->info['name']))),
'attributes' => array('title' => $this->t('Settings for @theme theme', array('@theme' => $theme->info['name']))),
);
}
if (!empty($theme->status)) {
@ -279,14 +279,14 @@ class SystemController extends ControllerBase {
'title' => $this->t('Uninstall'),
'url' => Url::fromRoute('system.theme_uninstall'),
'query' => $query,
'attributes' => array('title' => $this->t('Uninstall !theme theme', array('!theme' => $theme->info['name']))),
'attributes' => array('title' => $this->t('Uninstall @theme theme', array('@theme' => $theme->info['name']))),
);
}
$theme->operations[] = array(
'title' => $this->t('Set as default'),
'url' => Url::fromRoute('system.theme_set_default'),
'query' => $query,
'attributes' => array('title' => $this->t('Set !theme as default theme', array('!theme' => $theme->info['name']))),
'attributes' => array('title' => $this->t('Set @theme as default theme', array('@theme' => $theme->info['name']))),
);
}
$admin_theme_options[$theme->getName()] = $theme->info['name'];
@ -296,13 +296,13 @@ class SystemController extends ControllerBase {
'title' => $this->t('Install'),
'url' => Url::fromRoute('system.theme_install'),
'query' => $query,
'attributes' => array('title' => $this->t('Install !theme theme', array('!theme' => $theme->info['name']))),
'attributes' => array('title' => $this->t('Install @theme theme', array('@theme' => $theme->info['name']))),
);
$theme->operations[] = array(
'title' => $this->t('Install and set as default'),
'url' => Url::fromRoute('system.theme_set_default'),
'query' => $query,
'attributes' => array('title' => $this->t('Install !theme as default theme', array('!theme' => $theme->info['name']))),
'attributes' => array('title' => $this->t('Install @theme as default theme', array('@theme' => $theme->info['name']))),
);
}
}

View file

@ -67,7 +67,7 @@ class SystemInfoController implements ContainerInjectionInterface {
$output = ob_get_clean();
}
else {
$output = t('The phpinfo() function has been disabled for security reasons. For more information, visit <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array('@phpinfo' => 'https://www.drupal.org/node/243993'));
$output = t('The phpinfo() function has been disabled for security reasons. For more information, visit <a href=":phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array(':phpinfo' => 'https://www.drupal.org/node/243993'));
}
return new Response($output);
}

View file

@ -22,7 +22,7 @@ class DateFormatAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// There are no restrictions on viewing a date format.
if ($operation == 'view') {
return AccessResult::allowed();
@ -33,11 +33,11 @@ class DateFormatAccessControlHandler extends EntityAccessControlHandler {
return AccessResult::forbidden()->cacheUntilEntityChanges($entity);
}
else {
return parent::checkAccess($entity, $operation, $langcode, $account)->cacheUntilEntityChanges($entity);
return parent::checkAccess($entity, $operation, $account)->cacheUntilEntityChanges($entity);
}
}
return parent::checkAccess($entity, $operation, $langcode, $account);
return parent::checkAccess($entity, $operation, $account);
}
}

View file

@ -8,7 +8,7 @@
namespace Drupal\system;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
@ -24,7 +24,7 @@ class DateFormatListBuilder extends ConfigEntityListBuilder {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
@ -35,10 +35,10 @@ class DateFormatListBuilder extends ConfigEntityListBuilder {
* The entity type definition.
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage class.
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
*/
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatter $date_formatter) {
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatterInterface $date_formatter) {
parent::__construct($entity_type, $storage);
$this->dateFormatter = $date_formatter;

View file

@ -1,92 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\system\EventSubscriber\AutomaticCron.
*/
namespace Drupal\system\EventSubscriber;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\CronInterface;
use Drupal\Core\State\StateInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
/**
* A subscriber running cron when a request terminates.
*/
class AutomaticCron implements EventSubscriberInterface {
/**
* The cron service.
*
* @var \Drupal\Core\CronInterface
*/
protected $cron;
/**
* The cron configuration.
*
* @var \Drupal\Core\Config\Config
*/
protected $config;
/**
* The state key value store.
*
* Drupal\Core\State\StateInterface;
*/
protected $state;
/**
* Construct a new automatic cron runner.
*
* @param \Drupal\Core\CronInterface $cron
* The cron service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\State\StateInterface $state
* The state key value store.
*/
public function __construct(CronInterface $cron, ConfigFactoryInterface $config_factory, StateInterface $state) {
$this->cron = $cron;
$this->config = $config_factory->get('system.cron');
$this->state = $state;
}
/**
* Run the automated cron if enabled.
*
* @param Symfony\Component\HttpKernel\Event\PostResponseEvent $event
* The Event to process.
*/
public function onTerminate(PostResponseEvent $event) {
// If the site is not fully installed, suppress the automated cron run.
// Otherwise it could be triggered prematurely by Ajax requests during
// installation.
if ($this->state->get('install_task') == 'done') {
$threshold = $this->config->get('threshold.autorun');
if ($threshold > 0) {
$cron_next = $this->state->get('system.cron_last', 0) + $threshold;
if (REQUEST_TIME > $cron_next) {
$this->cron->run();
}
}
}
}
/**
* Registers the methods in this class that should be listeners.
*
* @return array
* An array of event listener definitions.
*/
public static function getSubscribedEvents() {
$events[KernelEvents::TERMINATE][] = array('onTerminate', 100);
return $events;
}
}

View file

@ -60,8 +60,8 @@ class ConfigCacheTag implements EventSubscriberInterface {
$this->cacheTagsInvalidator->invalidateTags(['route_match', 'rendered']);
}
// Global theme settings.
if ($event->getConfig()->getName() === 'system.theme.global') {
// Theme configuration and global theme settings.
if (in_array($event->getConfig()->getName(), ['system.theme', 'system.theme.global'], TRUE)) {
$this->cacheTagsInvalidator->invalidateTags(['rendered']);
}

View file

@ -59,7 +59,11 @@ class FileDownloadController extends ControllerBase {
}
if (count($headers)) {
return new BinaryFileResponse($uri, 200, $headers);
// \Drupal\Core\EventSubscriber\FinishResponseSubscriber::onRespond()
// sets response as not cacheable if the Cache-Control header is not
// already modified. We pass in FALSE for non-private schemes for the
// $public parameter to make sure we don't change the headers.
return new BinaryFileResponse($uri, 200, $headers, $scheme !== 'private');
}
throw new AccessDeniedHttpException();

View file

@ -9,17 +9,18 @@ namespace Drupal\system\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\CronInterface;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\Form\ConfigFormBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Configure cron settings for this site.
*/
class CronForm extends ConfigFormBase {
class CronForm extends FormBase {
/**
* Stores the state storage service.
@ -38,10 +39,17 @@ class CronForm extends ConfigFormBase {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
/**
* The module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
*/
protected $moduleHandler;
/**
* Constructs a CronForm object.
*
@ -51,14 +59,16 @@ class CronForm extends ConfigFormBase {
* The state key value store.
* @param \Drupal\Core\CronInterface $cron
* The cron service.
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler service.
*/
public function __construct(ConfigFactoryInterface $config_factory, StateInterface $state, CronInterface $cron, DateFormatter $date_formatter) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, StateInterface $state, CronInterface $cron, DateFormatterInterface $date_formatter, ModuleHandlerInterface $module_handler) {
$this->state = $state;
$this->cron = $cron;
$this->dateFormatter = $date_formatter;
$this->moduleHandler = $module_handler;
}
/**
@ -69,7 +79,8 @@ class CronForm extends ConfigFormBase {
$container->get('config.factory'),
$container->get('state'),
$container->get('cron'),
$container->get('date.formatter')
$container->get('date.formatter'),
$container->get('module_handler')
);
}
@ -80,68 +91,40 @@ class CronForm extends ConfigFormBase {
return 'system_cron_settings';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['system.cron'];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('system.cron');
$form['description'] = array(
'#markup' => '<p>' . t('Cron takes care of running periodic tasks like checking for updates and indexing content for search.') . '</p>',
);
$form['run'] = array(
'#type' => 'submit',
'#value' => t('Run cron'),
'#submit' => array('::submitCron'),
);
$status = '<p>' . $this->t('Last run: %time ago.', array('%time' => $this->dateFormatter->formatTimeDiffSince($this->state->get('system.cron_last')))) . '</p>';
$form['status'] = array(
'#markup' => $status,
);
$cron_url = $this->url('system.cron', array('key' => $this->state->get('system.cron_key')), array('absolute' => TRUE));
$form['cron_url'] = array(
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array('!cron' => $this->url('system.cron', array('key' => $this->state->get('system.cron_key')), array('absolute' => TRUE)))) . '</p>',
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href=":cron">@cron</a>', array(':cron' => $cron_url, '@cron' => $cron_url)) . '</p>',
);
$form['cron'] = array(
'#title' => t('Cron settings'),
'#type' => 'details',
'#open' => TRUE,
);
$options = array(3600, 10800, 21600, 43200, 86400, 604800);
$form['cron']['cron_safe_threshold'] = array(
'#type' => 'select',
'#title' => t('Run cron every'),
'#description' => t('More information about setting up scheduled tasks can be found by <a href="@url">reading the cron tutorial on drupal.org</a>.', array('@url' => 'https://www.drupal.org/cron')),
'#default_value' => $config->get('threshold.autorun'),
'#options' => array(0 => t('Never')) + array_map(array($this->dateFormatter, 'formatInterval'), array_combine($options, $options)),
);
if (!$this->moduleHandler->moduleExists('automated_cron')) {
$form['cron'] = array(
'#markup' => $this->t('Enable the <em>Automated Cron</em> module to allow cron execution at the end of a server response.'),
);
}
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('system.cron')
->set('threshold.autorun', $form_state->getValue('cron_safe_threshold'))
->save();
parent::submitForm($form, $form_state);
return $form;
}
/**
* Runs cron and reloads the page.
*/
public function submitCron(array &$form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state) {
// Run cron manually from Cron form.
if ($this->cron->run()) {
drupal_set_message(t('Cron run successfully.'));

View file

@ -7,7 +7,7 @@
namespace Drupal\system\Form;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\EntityDeleteForm;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -19,17 +19,17 @@ class DateFormatDeleteForm extends EntityDeleteForm {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
/**
* Constructs an DateFormatDeleteForm object.
*
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
*/
public function __construct(DateFormatter $date_formatter) {
public function __construct(DateFormatterInterface $date_formatter) {
$this->dateFormatter = $date_formatter;
}

View file

@ -8,7 +8,7 @@
namespace Drupal\system\Form;
use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -23,7 +23,7 @@ abstract class DateFormatFormBase extends EntityForm {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
@ -37,12 +37,12 @@ abstract class DateFormatFormBase extends EntityForm {
/**
* Constructs a new date format form.
*
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date service.
* @param \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $date_format_storage
* The date format storage.
*/
public function __construct(DateFormatter $date_formatter, ConfigEntityStorageInterface $date_format_storage) {
public function __construct(DateFormatterInterface $date_formatter, ConfigEntityStorageInterface $date_format_storage) {
$date = new DrupalDateTime();
$this->dateFormatter = $date_formatter;
@ -104,7 +104,7 @@ abstract class DateFormatFormBase extends EntityForm {
'#type' => 'textfield',
'#title' => t('Format string'),
'#maxlength' => 100,
'#description' => $this->t('A user-defined date format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php')),
'#description' => $this->t('A user-defined date format. See the <a href=":url">PHP manual</a> for available options.', array(':url' => 'http://php.net/manual/function.date.php')),
'#required' => TRUE,
'#attributes' => [
'data-drupal-date-formatter' => 'source',

View file

@ -8,7 +8,7 @@
namespace Drupal\system\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StreamWrapper\PrivateStream;
use Drupal\Core\StreamWrapper\PublicStream;
@ -25,7 +25,7 @@ class FileSystemForm extends ConfigFormBase {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
@ -41,12 +41,12 @@ class FileSystemForm extends ConfigFormBase {
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, DateFormatter $date_formatter, StreamWrapperManagerInterface $stream_wrapper_manager) {
public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, StreamWrapperManagerInterface $stream_wrapper_manager) {
parent::__construct($config_factory);
$this->dateFormatter = $date_formatter;
$this->streamWrapperManager = $stream_wrapper_manager;
@ -89,6 +89,13 @@ class FileSystemForm extends ConfigFormBase {
'#description' => t('A local file system path where public files will be stored. This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web. This must be changed in settings.php'),
);
$form['file_public_base_url'] = array(
'#type' => 'item',
'#title' => t('Public file base URL'),
'#markup' => PublicStream::baseUrl(),
'#description' => t('The base URL that will be used for public file URLs. This can be changed in settings.php'),
);
$form['file_private_path'] = array(
'#type' => 'item',
'#title' => t('Private file system path'),

View file

@ -59,34 +59,6 @@ class ModulesListForm extends FormBase {
*/
protected $keyValueExpirable;
/**
* The title resolver.
*
* @var \Drupal\Core\Controller\TitleResolverInterface
*/
protected $titleResolver;
/**
* The route provider.
*
* @var \Drupal\Core\Routing\RouteProviderInterface
*/
protected $routeProvider;
/**
* The current route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* The menu link manager.
*
* @var \Drupal\Core\Menu\MenuLinkManagerInterface
*/
protected $menuLinkManager;
/**
* The module installer.
*
@ -111,10 +83,6 @@ class ModulesListForm extends FormBase {
$container->get('keyvalue.expirable')->get('module_list'),
$container->get('access_manager'),
$container->get('current_user'),
$container->get('current_route_match'),
$container->get('title_resolver'),
$container->get('router.route_provider'),
$container->get('plugin.manager.menu.link'),
$container->get('user.permissions')
);
}
@ -132,27 +100,15 @@ class ModulesListForm extends FormBase {
* Access manager.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The current route match.
* @param \Drupal\Core\Controller\TitleResolverInterface $title_resolver
* The title resolver.
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
* The menu link manager.
* @param \Drupal\user\PermissionHandlerInterface $permission_handler
* The permission handler.
*/
public function __construct(ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, KeyValueStoreExpirableInterface $key_value_expirable, AccessManagerInterface $access_manager, AccountInterface $current_user, RouteMatchInterface $route_match, TitleResolverInterface $title_resolver, RouteProviderInterface $route_provider, MenuLinkManagerInterface $menu_link_manager, PermissionHandlerInterface $permission_handler) {
public function __construct(ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, KeyValueStoreExpirableInterface $key_value_expirable, AccessManagerInterface $access_manager, AccountInterface $current_user, PermissionHandlerInterface $permission_handler) {
$this->moduleHandler = $module_handler;
$this->moduleInstaller = $module_installer;
$this->keyValueExpirable = $key_value_expirable;
$this->accessManager = $access_manager;
$this->currentUser = $current_user;
$this->routeMatch = $route_match;
$this->titleResolver = $title_resolver;
$this->routeProvider = $route_provider;
$this->menuLinkManager = $menu_link_manager;
$this->permissionHandler = $permission_handler;
}
@ -214,11 +170,6 @@ class ModulesListForm extends FormBase {
'#title' => $this->t($package),
'#open' => TRUE,
'#theme' => 'system_modules_details',
'#header' => array(
array('data' => $this->t('Installed'), 'class' => array('checkbox', 'visually-hidden')),
array('data' => $this->t('Name'), 'class' => array('name', 'visually-hidden')),
array('data' => $this->t('Description'), 'class' => array('description', 'visually-hidden', RESPONSIVE_PRIORITY_LOW)),
),
'#attributes' => array('class' => array('package-listing')),
// Ensure that the "Core" package comes first.
'#weight' => $package == 'Core' ? -10 : NULL,
@ -270,7 +221,6 @@ class ModulesListForm extends FormBase {
// Generate link for module's help page. Assume that if a hook_help()
// implementation exists then the module provides an overview page, rather
// than checking to see if the page exists, which is costly.
$row['links']['help'] = array();
if ($this->moduleHandler->moduleExists('help') && $module->status && in_array($module->getName(), $this->moduleHandler->getImplementations('help'))) {
$row['links']['help'] = array(
'#type' => 'link',
@ -281,7 +231,6 @@ class ModulesListForm extends FormBase {
}
// Generate link for module's permission, if the user has access to it.
$row['links']['permissions'] = array();
if ($module->status && $this->currentUser->hasPermission('administer permissions') && $this->permissionHandler->moduleProvidesPermissions($module->getName())) {
$row['links']['permissions'] = array(
'#type' => 'link',
@ -292,36 +241,16 @@ class ModulesListForm extends FormBase {
}
// Generate link for module's configuration page, if it has one.
$row['links']['configure'] = array();
if ($module->status && isset($module->info['configure'])) {
$route_parameters = isset($module->info['configure_parameters']) ? $module->info['configure_parameters'] : array();
if ($this->accessManager->checkNamedRoute($module->info['configure'], $route_parameters, $this->currentUser)) {
$links = $this->menuLinkManager->loadLinksByRoute($module->info['configure']);
/** @var \Drupal\Core\Menu\MenuLinkInterface $link */
$link = reset($links);
// Most configure links have a corresponding menu link, though some just
// have a route.
if ($link) {
$description = $link->getDescription();
}
else {
$request = new Request();
$request->attributes->set('_route_name', $module->info['configure']);
$route_object = $this->routeProvider->getRouteByName($module->info['configure']);
$request->attributes->set('_route', $route_object);
$request->attributes->add($route_parameters);
$description = $this->titleResolver->getTitle($request, $route_object);
}
$row['links']['configure'] = array(
'#type' => 'link',
'#title' => $this->t('Configure'),
'#title' => $this->t('Configure <span class="visually-hidden">the @module module</span>', ['@module' => $module->info['name']]),
'#url' => Url::fromRoute($module->info['configure'], $route_parameters),
'#options' => array(
'attributes' => array(
'class' => array('module-link', 'module-link-configure'),
'title' => $description,
),
),
);
@ -353,8 +282,8 @@ class ModulesListForm extends FormBase {
// Check the core compatibility.
if ($module->info['core'] != \Drupal::CORE_COMPATIBILITY) {
$compatible = FALSE;
$reasons[] = $this->t('This version is not compatible with Drupal !core_version and should be replaced.', array(
'!core_version' => \Drupal::CORE_COMPATIBILITY,
$reasons[] = $this->t('This version is not compatible with Drupal @core_version and should be replaced.', array(
'@core_version' => \Drupal::CORE_COMPATIBILITY,
));
}
@ -362,9 +291,9 @@ class ModulesListForm extends FormBase {
if (version_compare(phpversion(), $module->info['php']) < 0) {
$compatible = FALSE;
$required = $module->info['php'] . (substr_count($module->info['php'], '.') < 2 ? '.*' : '');
$reasons[] = $this->t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array(
$reasons[] = $this->t('This module requires PHP version @php_required and is incompatible with PHP version @php_version.', array(
'@php_required' => $required,
'!php_version' => phpversion(),
'@php_version' => phpversion(),
));
}

View file

@ -11,7 +11,7 @@ use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -30,7 +30,7 @@ class PerformanceForm extends ConfigFormBase {
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatter
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
@ -54,14 +54,14 @@ class PerformanceForm extends ConfigFormBase {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Cache\CacheBackendInterface $render_cache
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $css_collection_optimizer
* The CSS asset collection optimizer service.
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $js_collection_optimizer
* The JavaScript asset collection optimizer service.
*/
public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatter $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatterInterface $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
parent::__construct($config_factory);
$this->renderCache = $render_cache;
@ -141,7 +141,7 @@ class PerformanceForm extends ConfigFormBase {
$disabled = !$is_writable;
$disabled_message = '';
if (!$is_writable) {
$disabled_message = ' ' . t('<strong class="error">Set up the <a href="!file-system">public files directory</a> to make these optimizations available.</strong>', array('!file-system' => $this->url('system.file_system_settings')));
$disabled_message = ' ' . t('<strong class="error">Set up the <a href=":file-system">public files directory</a> to make these optimizations available.</strong>', array(':file-system' => $this->url('system.file_system_settings')));
}
$form['bandwidth_optimization'] = array(

View file

@ -70,7 +70,7 @@ class SiteMaintenanceModeForm extends ConfigFormBase {
'#type' => 'checkbox',
'#title' => t('Put site into maintenance mode'),
'#default_value' => $this->state->get('system.maintenance_mode'),
'#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" <a href="@permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => $this->url('user.admin_permissions'), '@user-login' => $this->url('user.login'))),
'#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" <a href=":permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href=":user-login">user login</a> page.', array(':permissions-url' => $this->url('user.admin_permissions'), ':user-login' => $this->url('user.login'))),
);
$form['maintenance_mode_message'] = array(
'#type' => 'textarea',

View file

@ -141,9 +141,6 @@ class ThemeSettingsForm extends ConfigFormBase {
// Toggle settings
$toggles = array(
'logo' => t('Logo'),
'name' => t('Site name'),
'slogan' => t('Site slogan'),
'node_user_picture' => t('User pictures in posts'),
'comment_user_picture' => t('User pictures in comments'),
'comment_user_verification' => t('User verification status in comments'),

View file

@ -22,7 +22,7 @@ class MenuAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation === 'view') {
return AccessResult::allowed();
}
@ -32,11 +32,11 @@ class MenuAccessControlHandler extends EntityAccessControlHandler {
return AccessResult::forbidden()->cacheUntilEntityChanges($entity);
}
else {
return parent::checkAccess($entity, $operation, $langcode, $account)->cacheUntilEntityChanges($entity);
return parent::checkAccess($entity, $operation, $account)->cacheUntilEntityChanges($entity);
}
}
return parent::checkAccess($entity, $operation, $langcode, $account);
return parent::checkAccess($entity, $operation, $account);
}
}

View file

@ -143,7 +143,7 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$exclude['/user'] = TRUE;
// Because this breadcrumb builder is entirely path-based, vary by the
// 'url.path' cache context.
$breadcrumb->setCacheContexts(['url.path']);
$breadcrumb->addCacheContexts(['url.path']);
while (count($path_elements) > 1) {
array_pop($path_elements);
// Copy the path elements for up-casting.

View file

@ -89,9 +89,9 @@ class SystemBrandingBlock extends BlockBase implements ContainerFactoryPluginInt
if ($url_system_theme_settings->access() && $url_system_theme_settings_theme->access()) {
// Provide links to the Appearance Settings and Theme Settings pages
// if the user has access to administer themes.
$site_logo_description = $this->t('Defined on the <a href="@appearance">Appearance Settings</a> or <a href="@theme">Theme Settings</a> page.', array(
'@appearance' => $url_system_theme_settings->toString(),
'@theme' => $url_system_theme_settings_theme->toString(),
$site_logo_description = $this->t('Defined on the <a href=":appearance">Appearance Settings</a> or <a href=":theme">Theme Settings</a> page.', array(
':appearance' => $url_system_theme_settings->toString(),
':theme' => $url_system_theme_settings_theme->toString(),
));
}
else {
@ -106,8 +106,8 @@ class SystemBrandingBlock extends BlockBase implements ContainerFactoryPluginInt
// Provide link to Site Information page if the user has access to
// administer site configuration.
$site_name_description = $this->t('Defined on the <a href="@information">Site Information</a> page.', array('@information' => $site_information_url));
$site_slogan_description = $this->t('Defined on the <a href="@information">Site Information</a> page.', array('@information' => $site_information_url));
$site_name_description = $this->t('Defined on the <a href=":information">Site Information</a> page.', array(':information' => $site_information_url));
$site_slogan_description = $this->t('Defined on the <a href=":information">Site Information</a> page.', array(':information' => $site_information_url));
}
else {
// Explain that the user does not have access to the Site Information
@ -160,10 +160,9 @@ class SystemBrandingBlock extends BlockBase implements ContainerFactoryPluginInt
$build = array();
$site_config = $this->configFactory->get('system.site');
$logo = theme_get_setting('logo');
$build['site_logo'] = array(
'#theme' => 'image',
'#uri' => $logo['url'],
'#uri' => theme_get_setting('logo.url'),
'#alt' => $this->t('Home'),
'#access' => $this->configuration['use_site_logo'],
);

View file

@ -74,16 +74,7 @@ class SystemBreadcrumbBlock extends BlockBase implements ContainerFactoryPluginI
* {@inheritdoc}
*/
public function build() {
$breadcrumb = $this->breadcrumbManager->build($this->routeMatch);
if (!empty($breadcrumb)) {
// $breadcrumb is expected to be an array of rendered breadcrumb links.
$build = [
'#theme' => 'breadcrumb',
'#links' => $breadcrumb->getLinks(),
];
$breadcrumb->applyTo($build);
return $build;
}
return $this->breadcrumbManager->build($this->routeMatch)->toRenderable();
}
}

View file

@ -43,17 +43,4 @@ class SystemMainBlock extends BlockBase implements MainContentBlockPluginInterfa
return $this->mainContent;
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['cache']['#disabled'] = TRUE;
$form['cache']['#description'] = $this->t("This block's maximum age cannot be configured, because it depends on the contents.");
$form['cache']['max_age']['#value'] = Cache::PERMANENT;
return $form;
}
}

View file

@ -40,20 +40,6 @@ class SystemMessagesBlock extends BlockBase implements MessagesBlockPluginInterf
return ['#type' => 'status_messages'];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
// @see ::getCacheMaxAge()
$form['cache']['#description'] = $this->t('This block is cacheable forever, it is not configurable.');
$form['cache']['max_age']['#value'] = Cache::PERMANENT;
$form['cache']['max_age']['#disabled'] = TRUE;
return $form;
}
/**
* {@inheritdoc}
*/

View file

@ -25,30 +25,7 @@ class SystemPoweredByBlock extends BlockBase {
* {@inheritdoc}
*/
public function build() {
return array('#markup' => '<span>' . $this->t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'https://www.drupal.org')) . '</span>');
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
// @see ::getCacheMaxAge()
$form['cache']['#disabled'] = TRUE;
$form['cache']['max_age']['#value'] = Cache::PERMANENT;
$form['cache']['#description'] = $this->t('This block is always cached forever, it is not configurable.');
return $form;
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
// The 'Powered by Drupal' block is permanently cacheable, because its
// contents can never change.
return Cache::PERMANENT;
return array('#markup' => '<span>' . $this->t('Powered by <a href=":poweredby">Drupal</a>', array(':poweredby' => 'https://www.drupal.org')) . '</span>');
}
}

View file

@ -13,10 +13,10 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\ImageToolkit\ImageToolkitBase;
use Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface;
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
/**
* Defines the GD2 toolkit for image manipulation within Drupal.
@ -65,7 +65,7 @@ class GDToolkit extends ImageToolkitBase {
protected $streamWrapperManager;
/**
* Constructs a TestToolkit object.
* Constructs a GDToolkit object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
@ -87,6 +87,17 @@ class GDToolkit extends ImageToolkitBase {
$this->streamWrapperManager = $stream_wrapper_manager;
}
/**
* Destructs a GDToolkit object.
*
* Frees memory associated with a GD image resource.
*/
public function __destruct() {
if (is_resource($this->resource)) {
imagedestroy($this->resource);
}
}
/**
* {@inheritdoc}
*/
@ -108,9 +119,13 @@ class GDToolkit extends ImageToolkitBase {
* @param resource $resource
* The GD image resource.
*
* @return $this
* @return \Drupal\system\Plugin\ImageToolkit\GDToolkit
* An instance of the current toolkit object.
*/
public function setResource($resource) {
if (!is_resource($resource) || get_resource_type($resource) != 'gd') {
throw new \InvalidArgumentException('Invalid resource argument');
}
$this->preLoadInfo = NULL;
$this->resource = $resource;
return $this;
@ -123,7 +138,7 @@ class GDToolkit extends ImageToolkitBase {
* The GD image resource, or NULL if not available.
*/
public function getResource() {
if (!$this->resource) {
if (!is_resource($this->resource)) {
$this->load();
}
return $this->resource;
@ -167,7 +182,7 @@ class GDToolkit extends ImageToolkitBase {
}
$function = 'imagecreatefrom' . image_type_to_extension($this->getType(), FALSE);
if (function_exists($function) && $resource = $function($this->getImage()->getSource())) {
if (function_exists($function) && $resource = $function($this->getSource())) {
$this->setResource($resource);
if (imageistruecolor($resource)) {
return TRUE;
@ -181,6 +196,7 @@ class GDToolkit extends ImageToolkitBase {
'height' => imagesy($resource),
'extension' => image_type_to_extension($this->getType(), FALSE),
'transparent_color' => $this->getTransparentColor(),
'is_temp' => TRUE,
);
if ($this->apply('create_new', $data)) {
imagecopy($this->getResource(), $resource, 0, 0, 0, 0, imagesx($resource), imagesy($resource));
@ -242,7 +258,7 @@ class GDToolkit extends ImageToolkitBase {
* {@inheritdoc}
*/
public function parseFile() {
$data = @getimagesize($this->getImage()->getSource());
$data = @getimagesize($this->getSource());
if ($data && in_array($data[2], static::supportedTypes())) {
$this->setType($data[2]);
$this->preLoadInfo = $data;
@ -362,7 +378,7 @@ class GDToolkit extends ImageToolkitBase {
// Check for filter and rotate support.
if (!function_exists('imagefilter') || !function_exists('imagerotate')) {
$requirements['version']['severity'] = REQUIREMENT_WARNING;
$requirements['version']['description'] = t('The GD Library for PHP is enabled, but was compiled without support for functions used by the rotate and desaturate effects. It was probably compiled using the official GD libraries from http://www.libgd.org instead of the GD library bundled with PHP. You should recompile PHP --with-gd using the bundled GD library. See <a href="@url">the PHP manual</a>.', array('@url' => 'http://www.php.net/manual/book.image.php'));
$requirements['version']['description'] = t('The GD Library for PHP is enabled, but was compiled without support for functions used by the rotate and desaturate effects. It was probably compiled using the official GD libraries from http://www.libgd.org instead of the GD library bundled with PHP. You should recompile PHP --with-gd using the bundled GD library. See <a href=":url">the PHP manual</a>.', array(':url' => 'http://www.php.net/manual/book.image.php'));
}
return $requirements;

View file

@ -56,7 +56,8 @@ class Convert extends GDImageToolkitOperationBase {
'width' => $width,
'height' => $height,
'extension' => $arguments['extension'],
'transparent_color' => $this->getToolkit()->getTransparentColor()
'transparent_color' => $this->getToolkit()->getTransparentColor(),
'is_temp' => TRUE,
);
if ($this->getToolkit()->apply('create_new', $data)) {
if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, 0, 0, $width, $height, $width, $height)) {

View file

@ -43,6 +43,11 @@ class CreateNew extends GDImageToolkitOperationBase {
'required' => FALSE,
'default' => '#ffffff',
),
'is_temp' => array(
'description' => 'If TRUE, this operation is being used to create a temporary image by another GD operation. After performing its function, the caller is responsible for destroying the original GD resource.',
'required' => FALSE,
'default' => FALSE,
),
);
}
@ -82,6 +87,9 @@ class CreateNew extends GDImageToolkitOperationBase {
// Get the image type.
$type = $this->getToolkit()->extensionToImageType($arguments['extension']);
// Store the original GD resource.
$original_res = $this->getToolkit()->getResource();
// Create the resource.
if (!$res = imagecreatetruecolor($arguments['width'], $arguments['height'])) {
return FALSE;
@ -119,6 +127,12 @@ class CreateNew extends GDImageToolkitOperationBase {
// Update the toolkit properties.
$this->getToolkit()->setType($type);
$this->getToolkit()->setResource($res);
// Destroy the original resource if it is not needed by other operations.
if (!$arguments['is_temp'] && is_resource($original_res)) {
imagedestroy($original_res);
}
return TRUE;
}

View file

@ -86,13 +86,20 @@ class Crop extends GDImageToolkitOperationBase {
'width' => $arguments['width'],
'height' => $arguments['height'],
'extension' => image_type_to_extension($this->getToolkit()->getType(), FALSE),
'transparent_color' => $this->getToolkit()->getTransparentColor()
'transparent_color' => $this->getToolkit()->getTransparentColor(),
'is_temp' => TRUE,
);
if ($this->getToolkit()->apply('create_new', $data)) {
if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, $arguments['x'], $arguments['y'], $arguments['width'], $arguments['height'], $arguments['width'], $arguments['height'])) {
imagedestroy($original_resource);
return TRUE;
}
else {
// In case of failure, destroy the temporary resource and restore
// the original one.
imagedestroy($this->getToolkit()->getResource());
$this->getToolkit()->setResource($original_resource);
}
}
return FALSE;
}

View file

@ -34,7 +34,7 @@ class Desaturate extends GDImageToolkitOperationBase {
protected function execute(array $arguments) {
// PHP installations using non-bundled GD do not have imagefilter.
if (!function_exists('imagefilter')) {
$this->logger->notice("The image '@file' could not be desaturated because the imagefilter() function is not available in this PHP installation.", array('@file' => $this->getToolkit()->getImage()->getSource()));
$this->logger->notice("The image '@file' could not be desaturated because the imagefilter() function is not available in this PHP installation.", array('@file' => $this->getToolkit()->getSource()));
return FALSE;
}

View file

@ -65,13 +65,20 @@ class Resize extends GDImageToolkitOperationBase {
'width' => $arguments['width'],
'height' => $arguments['height'],
'extension' => image_type_to_extension($this->getToolkit()->getType(), FALSE),
'transparent_color' => $this->getToolkit()->getTransparentColor()
'transparent_color' => $this->getToolkit()->getTransparentColor(),
'is_temp' => TRUE,
);
if ($this->getToolkit()->apply('create_new', $data)) {
if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, 0, 0, $arguments['width'], $arguments['height'], imagesx($original_resource), imagesy($original_resource))) {
imagedestroy($original_resource);
return TRUE;
}
else {
// In case of failure, destroy the temporary resource and restore
// the original one.
imagedestroy($this->getToolkit()->getResource());
$this->getToolkit()->setResource($original_resource);
}
}
return FALSE;
}

View file

@ -94,21 +94,29 @@ class Rotate extends GDImageToolkitOperationBase {
protected function execute(array $arguments) {
// PHP installations using non-bundled GD do not have imagerotate.
if (!function_exists('imagerotate')) {
$this->logger->notice('The image %file could not be rotated because the imagerotate() function is not available in this PHP installation.', array('%file' => $this->getToolkit()->getImage()->getSource()));
$this->logger->notice('The image %file could not be rotated because the imagerotate() function is not available in this PHP installation.', array('%file' => $this->getToolkit()->getSource()));
return FALSE;
}
$this->getToolkit()->setResource(imagerotate($this->getToolkit()->getResource(), 360 - $arguments['degrees'], $arguments['background_idx']));
// Stores the original GD resource.
$original_res = $this->getToolkit()->getResource();
// GIFs need to reassign the transparent color after performing the rotate,
// but only do so, if the image already had transparency of its own, or the
// rotate added a transparent background.
if (!empty($arguments['gif_transparent_color'])) {
$transparent_idx = imagecolorexactalpha($this->getToolkit()->getResource(), $arguments['gif_transparent_color']['red'], $arguments['gif_transparent_color']['green'], $arguments['gif_transparent_color']['blue'], $arguments['gif_transparent_color']['alpha']);
imagecolortransparent($this->getToolkit()->getResource(), $transparent_idx);
if ($new_res = imagerotate($this->getToolkit()->getResource(), 360 - $arguments['degrees'], $arguments['background_idx'])) {
$this->getToolkit()->setResource($new_res);
imagedestroy($original_res);
// GIFs need to reassign the transparent color after performing the
// rotate, but only do so, if the image already had transparency of its
// own, or the rotate added a transparent background.
if (!empty($arguments['gif_transparent_color'])) {
$transparent_idx = imagecolorexactalpha($this->getToolkit()->getResource(), $arguments['gif_transparent_color']['red'], $arguments['gif_transparent_color']['green'], $arguments['gif_transparent_color']['blue'], $arguments['gif_transparent_color']['alpha']);
imagecolortransparent($this->getToolkit()->getResource(), $transparent_idx);
}
return TRUE;
}
return TRUE;
return FALSE;
}
}

View file

@ -7,6 +7,7 @@
namespace Drupal\system\Plugin\views\field;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\RevisionableInterface;
@ -15,7 +16,6 @@ use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Routing\RedirectDestinationTrait;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\views\Entity\Render\EntityTranslationRenderTrait;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait;
@ -29,7 +29,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @ViewsField("bulk_form")
*/
class BulkForm extends FieldPluginBase implements CacheablePluginInterface {
class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
use RedirectDestinationTrait;
use UncacheableFieldHandlerTrait;
@ -114,10 +114,10 @@ class BulkForm extends FieldPluginBase implements CacheablePluginInterface {
/**
* {@inheritdoc}
*/
public function isCacheable() {
public function getCacheMaxAge() {
// @todo Consider making the bulk operation form cacheable. See
// https://www.drupal.org/node/2503009.
return FALSE;
return 0;
}
/**
@ -127,6 +127,13 @@ class BulkForm extends FieldPluginBase implements CacheablePluginInterface {
return $this->languageManager->isMultilingual() ? $this->getEntityTranslationRenderer()->getCacheContexts() : [];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
/**
* {@inheritdoc}
*/

View file

@ -99,7 +99,7 @@ class ActionUnitTest extends KernelTestBase {
'user',
),
);
$this->assertIdentical($expected, $action->calculateDependencies());
$this->assertIdentical($expected, $action->calculateDependencies()->getDependencies());
}
}

View file

@ -49,7 +49,7 @@ class AjaxFormCacheTest extends AjaxTestBase {
$this->drupalLogin($this->rootUser);
$this->drupalPlaceBlock('search_form_block', ['weight' => -5]);
$this->drupalPlaceBlock('ajax_forms_test_block', ['cache' => ['max_age' => 0]]);
$this->drupalPlaceBlock('ajax_forms_test_block');
$this->drupalGet('');
$this->drupalPostAjaxForm(NULL, ['test1' => 'option1'], 'test1');
@ -66,7 +66,7 @@ class AjaxFormCacheTest extends AjaxTestBase {
$this->container->get('module_installer')->install(['block']);
$this->drupalLogin($this->rootUser);
$this->drupalPlaceBlock('ajax_forms_test_block', ['cache' => ['max_age' => 0]]);
$this->drupalPlaceBlock('ajax_forms_test_block');
$url = Url::fromRoute('entity.user.canonical', ['user' => $this->rootUser->id()], ['query' => ['foo' => 'bar']]);
$this->drupalGet($url);

View file

@ -7,39 +7,289 @@
namespace Drupal\system\Tests\Asset;
use Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException;
use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
use Drupal\simpletest\KernelTestBase;
/**
* Tests the element info.
* Tests the library discovery and library discovery parser.
*
* @group Render
*/
class LibraryDiscoveryIntegrationTest extends KernelTestBase {
/**
* The library discovery service.
*
* @var \Drupal\Core\Asset\LibraryDiscoveryInterface
*/
protected $libraryDiscovery;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->container->get('theme_handler')->install(['test_theme', 'classy']);
$this->container->get('theme_installer')->install(['test_theme', 'classy']);
$this->libraryDiscovery = $this->container->get('library.discovery');
}
/**
* Ensures that the element info can be altered by themes.
*/
public function testElementInfoByTheme() {
$this->activateTheme('test_theme');
$this->assertTrue($this->libraryDiscovery->getLibraryByName('test_theme', 'kitten'));
}
/**
* Tests that libraries-override are applied to library definitions.
*/
public function testLibrariesOverride() {
// Assert some classy libraries that will be overridden or removed.
$this->activateTheme('classy');
$this->assertAssetInLibrary('core/themes/classy/css/components/button.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/themes/classy/css/components/collapse-processed.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/themes/classy/css/components/container-inline.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/themes/classy/css/components/details.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/themes/classy/css/components/dialog.css', 'classy', 'dialog', 'css');
// Confirmatory assert on core library to be removed.
$this->assertTrue($this->libraryDiscovery->getLibraryByName('core', 'drupal.progress'), 'Confirmatory test on "core/drupal.progress"');
// Activate test theme that defines libraries overrides.
$this->activateTheme('test_theme');
// Assert that entire library was correctly overridden.
$this->assertEqual($this->libraryDiscovery->getLibraryByName('core', 'drupal.collapse'), $this->libraryDiscovery->getLibraryByName('test_theme', 'collapse'), 'Entire library correctly overridden.');
// Assert that classy library assets were correctly overridden or removed.
$this->assertNoAssetInLibrary('core/themes/classy/css/components/button.css', 'classy', 'base', 'css');
$this->assertNoAssetInLibrary('core/themes/classy/css/components/collapse-processed.css', 'classy', 'base', 'css');
$this->assertNoAssetInLibrary('core/themes/classy/css/components/container-inline.css', 'classy', 'base', 'css');
$this->assertNoAssetInLibrary('core/themes/classy/css/components/details.css', 'classy', 'base', 'css');
$this->assertNoAssetInLibrary('core/themes/classy/css/components/dialog.css', 'classy', 'dialog', 'css');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_theme/css/my-button.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_theme/css/my-collapse-processed.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('themes/my_theme/css/my-container-inline.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('themes/my_theme/css/my-details.css', 'classy', 'base', 'css');
// Assert that entire library was correctly removed.
$this->assertFalse($this->libraryDiscovery->getLibraryByName('core', 'drupal.progress'), 'Entire library correctly removed.');
// Assert that overridden library asset still retains attributes.
$library = $this->libraryDiscovery->getLibraryByName('core', 'jquery');
foreach ($library['js'] as $definition) {
if ($definition['data'] == 'core/modules/system/tests/themes/test_theme/js/collapse.js') {
$this->assertTrue($definition['minified'] && $definition['weight'] == -20, 'Previous attributes retained');
break;
}
}
}
/**
* Tests libraries-override on drupalSettings.
*/
public function testLibrariesOverrideDrupalSettings() {
// Activate test theme that attempts to override drupalSettings.
$this->activateTheme('test_theme_libraries_override_with_drupal_settings');
// Assert that drupalSettings cannot be overridden and throws an exception.
try {
$this->libraryDiscovery->getLibraryByName('core', 'drupal.ajax');
$this->fail('Throw Exception when trying to override drupalSettings');
}
catch (InvalidLibrariesOverrideSpecificationException $e) {
$expected_message = 'drupalSettings may not be overridden in libraries-override. Trying to override core/drupal.ajax/drupalSettings. Use hook_library_info_alter() instead.';
$this->assertEqual($e->getMessage(), $expected_message, 'Throw Exception when trying to override drupalSettings');
}
}
/**
* Tests libraries-override on malformed assets.
*/
public function testLibrariesOverrideMalformedAsset() {
// Activate test theme that overrides with a malformed asset.
$this->activateTheme('test_theme_libraries_override_with_invalid_asset');
// Assert that improperly formed asset "specs" throw an exception.
try {
$this->libraryDiscovery->getLibraryByName('core', 'drupal.dialog');
$this->fail('Throw Exception when specifying invalid override');
}
catch (InvalidLibrariesOverrideSpecificationException $e) {
$expected_message = 'Library asset core/drupal.dialog/css is not correctly specified. It should be in the form "extension/library_name/sub_key/path/to/asset.js".';
$this->assertEqual($e->getMessage(), $expected_message, 'Throw Exception when specifying invalid override');
}
}
/**
* Tests library assets with other ways for specifying paths.
*/
public function testLibrariesOverrideOtherAssetLibraryNames() {
// Activate a test theme that defines libraries overrides on other types of
// assets.
$this->activateTheme('test_theme');
// Assert Drupal-relative paths.
$this->assertAssetInLibrary('themes/my_theme/css/dropbutton.css', 'core', 'drupal.dropbutton', 'css');
// Assert stream wrapper paths.
$this->assertAssetInLibrary('public://my_css/vertical-tabs.css', 'core', 'drupal.vertical-tabs', 'css');
// Assert a protocol-relative URI.
$this->assertAssetInLibrary('//my-server/my_theme/css/jquery_ui.css', 'core', 'jquery.ui', 'css');
// Assert an absolute URI.
$this->assertAssetInLibrary('http://example.com/my_theme/css/farbtastic.css', 'core', 'jquery.farbtastic', 'css');
}
/**
* Tests that base theme libraries-override still apply in sub themes.
*/
public function testBaseThemeLibrariesOverrideInSubTheme() {
// Activate a test theme that has subthemes.
$this->activateTheme('test_subtheme');
// Assert that libraries-override specified in the base theme still applies
// in the sub theme.
$this->assertNoAssetInLibrary('core/misc/dialog/dialog.js', 'core', 'drupal.dialog', 'js');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_basetheme/css/farbtastic.css', 'core', 'jquery.farbtastic', 'css');
}
/**
* Tests libraries-extend.
*/
public function testLibrariesExtend() {
// Activate classy themes and verify the libraries are not extended.
$this->activateTheme('classy');
$this->assertNoAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/css/extend_1.css', 'classy', 'book-navigation', 'css');
$this->assertNoAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/js/extend_1.js', 'classy', 'book-navigation', 'js');
$this->assertNoAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/css/extend_2.css', 'classy', 'book-navigation', 'css');
// Activate the theme that extends the book-navigation library in classy.
$this->activateTheme('test_theme_libraries_extend');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/css/extend_1.css', 'classy', 'book-navigation', 'css');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/js/extend_1.js', 'classy', 'book-navigation', 'js');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_theme_libraries_extend/css/extend_2.css', 'classy', 'book-navigation', 'css');
// Activate a sub theme and confirm that it inherits the library assets
// extended in the base theme as well as its own.
$this->assertNoAssetInLibrary('core/modules/system/tests/themes/test_basetheme/css/base-libraries-extend.css', 'classy', 'base', 'css');
$this->assertNoAssetInLibrary('core/modules/system/tests/themes/test_subtheme/css/sub-libraries-extend.css', 'classy', 'base', 'css');
$this->activateTheme('test_subtheme');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_basetheme/css/base-libraries-extend.css', 'classy', 'base', 'css');
$this->assertAssetInLibrary('core/modules/system/tests/themes/test_subtheme/css/sub-libraries-extend.css', 'classy', 'base', 'css');
// Activate test theme that extends with a non-existent library. An
// exception should be thrown.
$this->activateTheme('test_theme_libraries_extend');
try {
$this->libraryDiscovery->getLibraryByName('core', 'drupal.dialog');
$this->fail('Throw Exception when specifying non-existent libraries-extend.');
}
catch (InvalidLibrariesExtendSpecificationException $e) {
$expected_message = 'The specified library "test_theme_libraries_extend/non_existent_library" does not exist.';
$this->assertEqual($e->getMessage(), $expected_message, 'Throw Exception when specifying non-existent libraries-extend.');
}
// Also, test non-string libraries-extend. An exception should be thrown.
$this->container->get('theme_installer')->install(['test_theme']);
try {
$this->libraryDiscovery->getLibraryByName('test_theme', 'collapse');
$this->fail('Throw Exception when specifying non-string libraries-extend.');
}
catch (InvalidLibrariesExtendSpecificationException $e) {
$expected_message = 'The libraries-extend specification for each library must be a list of strings.';
$this->assertEqual($e->getMessage(), $expected_message, 'Throw Exception when specifying non-string libraries-extend.');
}
}
/**
* Activates a specified theme.
*
* Installs the theme if not already installed and makes it the active theme.
*
* @param string $theme_name
* The name of the theme to be activated.
*/
protected function activateTheme($theme_name) {
$this->container->get('theme_installer')->install([$theme_name]);
/** @var \Drupal\Core\Theme\ThemeInitializationInterface $theme_initializer */
$theme_initializer = $this->container->get('theme.initialization');
/** @var \Drupal\Core\Theme\ThemeManagerInterface $theme_manager */
$theme_manager = $this->container->get('theme.manager');
/** @var \Drupal\Core\Render\ElementInfoManagerInterface $element_info */
$library_discovery = $this->container->get('library.discovery');
$theme_manager->setActiveTheme($theme_initializer->getActiveThemeByName($theme_name));
$theme_manager->setActiveTheme($theme_initializer->getActiveThemeByName('test_theme'));
$this->assertTrue($library_discovery->getLibraryByName('test_theme', 'kitten'));
$this->libraryDiscovery->clearCachedDefinitions();
// Assert message.
$this->pass(sprintf('Activated theme "%s"', $theme_name));
}
/**
* Asserts that the specified asset is in the given library.
*
* @param string $asset
* The asset file with the path for the file.
* @param string $extension
* The extension in which the $library is defined.
* @param string $library_name
* Name of the library.
* @param mixed $sub_key
* The library sub key where the given asset is defined.
* @param string $message
* (optional) A message to display with the assertion.
*
* @return bool
* TRUE if the specified asset is found in the library.
*/
protected function assertAssetInLibrary($asset, $extension, $library_name, $sub_key, $message = NULL) {
if (!isset($message)) {
$message = sprintf('Asset %s found in library "%s/%s"', $asset, $extension, $library_name);
}
$library = $this->libraryDiscovery->getLibraryByName($extension, $library_name);
foreach ($library[$sub_key] as $definition) {
if ($asset == $definition['data']) {
return $this->pass($message);
}
}
return $this->fail($message);
}
/**
* Asserts that the specified asset is not in the given library.
*
* @param string $asset
* The asset file with the path for the file.
* @param string $extension
* The extension in which the $library_name is defined.
* @param string $library_name
* Name of the library.
* @param mixed $sub_key
* The library sub key where the given asset is defined.
* @param string $message
* (optional) A message to display with the assertion.
*
* @return bool
* TRUE if the specified asset is not found in the library.
*/
protected function assertNoAssetInLibrary($asset, $extension, $library_name, $sub_key, $message = NULL) {
if (!isset($message)) {
$message = sprintf('Asset %s not found in library "%s/%s"', $asset, $extension, $library_name);
}
$library = $this->libraryDiscovery->getLibraryByName($extension, $library_name);
foreach ($library[$sub_key] as $definition) {
if ($asset == $definition['data']) {
return $this->fail($message);
}
}
return $this->pass($message);
}
}

View file

@ -54,12 +54,14 @@ class ProcessingTest extends WebTestBase {
// Batch 0: no operation.
$edit = array('batch' => 'batch_0');
$this->drupalPostForm('batch-test', $edit, 'Submit');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
// Batch 1: several simple operations.
$edit = array('batch' => 'batch_1');
$this->drupalPostForm('batch-test', $edit, 'Submit');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch with simple operations performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
@ -67,6 +69,7 @@ class ProcessingTest extends WebTestBase {
// Batch 2: one multistep operation.
$edit = array('batch' => 'batch_2');
$this->drupalPostForm('batch-test', $edit, 'Submit');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch with multistep operation performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
@ -74,6 +77,7 @@ class ProcessingTest extends WebTestBase {
// Batch 3: simple + multistep combined.
$edit = array('batch' => 'batch_3');
$this->drupalPostForm('batch-test', $edit, 'Submit');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertBatchMessages($this->_resultMessages('batch_3'), 'Batch with simple and multistep operations performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
@ -81,6 +85,7 @@ class ProcessingTest extends WebTestBase {
// Batch 4: nested batch.
$edit = array('batch' => 'batch_4');
$this->drupalPostForm('batch-test', $edit, 'Submit');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertBatchMessages($this->_resultMessages('batch_4'), 'Nested batch performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
@ -91,6 +96,7 @@ class ProcessingTest extends WebTestBase {
*/
function testBatchFormMultistep() {
$this->drupalGet('batch-test/multistep');
$this->assertNoEscaped('<', 'No escaped markup is present.');
$this->assertText('step 1', 'Form is displayed in step 1.');
// First step triggers batch 1.
@ -98,12 +104,14 @@ class ProcessingTest extends WebTestBase {
$this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
$this->assertText('step 2', 'Form is displayed in step 2.');
$this->assertNoEscaped('<', 'No escaped markup is present.');
// Second step triggers batch 2.
$this->drupalPostForm(NULL, array(), 'Submit');
$this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
$this->assertNoEscaped('<', 'No escaped markup is present.');
}
/**

View file

@ -162,7 +162,7 @@ class SystemMenuBlockTest extends KernelTestBase {
'theme' => 'stark',
));
$dependencies = $block->calculateDependencies();
$dependencies = $block->calculateDependencies()->getDependencies();
$expected = array(
'config' => array(
'system.menu.' . $this->menu->id()

View file

@ -37,14 +37,14 @@ class DrupalSetMessageTest extends WebTestBase {
$this->assertUniqueText('Non Duplicated message');
$this->assertNoUniqueText('Duplicated message');
// Ensure SafeString objects are rendered as expected.
$this->assertRaw('SafeString with <em>markup!</em>');
$this->assertUniqueText('SafeString with markup!');
$this->assertRaw('SafeString2 with <em>markup!</em>');
// Ensure Markup objects are rendered as expected.
$this->assertRaw('Markup with <em>markup!</em>');
$this->assertUniqueText('Markup with markup!');
$this->assertRaw('Markup2 with <em>markup!</em>');
// Ensure when the same message is of different types it is not duplicated.
$this->assertUniqueText('Non duplicate SafeString / string.');
$this->assertNoUniqueText('Duplicate SafeString / string.');
$this->assertUniqueText('Non duplicate Markup / string.');
$this->assertNoUniqueText('Duplicate Markup / string.');
// Ensure that strings that are not marked as safe are escaped.
$this->assertEscaped('<em>This<span>markup will be</span> escaped</em>.');

View file

@ -17,8 +17,18 @@ use Drupal\Core\Cache\ApcuBackend;
*/
class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
protected function checkRequirements() {
$requirements = parent::checkRequirements();
/**
* Get a list of failed requirements.
*
* This specifically bypasses checkRequirements because it fails tests. PHP 7
* does not have APC and simpletest does not have a explicit "skip"
* functionality so to emulate it we override all test methods and explicitly
* pass when requirements are not met.
*
* @return array
*/
protected function getRequirements() {
$requirements = [];
if (!extension_loaded('apc')) {
$requirements[] = 'APC extension not found.';
}
@ -33,10 +43,35 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
return $requirements;
}
/**
* Check if requirements fail.
*
* If the requirements fail the test method should return immediately instead
* of running any tests. Messages will be output to display why the test was
* skipped.
*/
protected function requirementsFail() {
$requirements = $this->getRequirements();
if (!empty($requirements)) {
foreach ($requirements as $message) {
$this->pass($message);
}
return TRUE;
}
return FALSE;
}
/**
* {@inheritdoc}
*/
protected function createCacheBackend($bin) {
return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
}
/**
* {@inheritdoc}
*/
protected function tearDown() {
foreach ($this->cachebackends as $bin => $cachebackend) {
$this->cachebackends[$bin]->removeBin();
@ -44,4 +79,114 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
parent::tearDown();
}
/**
* {@inheritdoc}
*/
public function testSetGet() {
if ($this->requirementsFail()) {
return;
}
parent::testSetGet();
}
/**
* {@inheritdoc}
*/
public function testDelete() {
if ($this->requirementsFail()) {
return;
}
parent::testDelete();
}
/**
* {@inheritdoc}
*/
public function testValueTypeIsKept() {
if ($this->requirementsFail()) {
return;
}
parent::testValueTypeIsKept();
}
/**
* {@inheritdoc}
*/
public function testGetMultiple() {
if ($this->requirementsFail()) {
return;
}
parent::testGetMultiple();
}
/**
* {@inheritdoc}
*/
public function testSetMultiple() {
if ($this->requirementsFail()) {
return;
}
parent::testSetMultiple();
}
/**
* {@inheritdoc}
*/
public function testDeleteMultiple() {
if ($this->requirementsFail()) {
return;
}
parent::testDeleteMultiple();
}
/**
* {@inheritdoc}
*/
public function testDeleteAll() {
if ($this->requirementsFail()) {
return;
}
parent::testDeleteAll();
}
/**
* {@inheritdoc}
*/
public function testInvalidate() {
if ($this->requirementsFail()) {
return;
}
parent::testInvalidate();
}
/**
* {@inheritdoc}
*/
public function testInvalidateTags() {
if ($this->requirementsFail()) {
return;
}
parent::testInvalidateTags();
}
/**
* {@inheritdoc}
*/
public function testInvalidateAll() {
if ($this->requirementsFail()) {
return;
}
parent::testInvalidateAll();
}
/**
* {@inheritdoc}
*/
public function testRemoveBin() {
if ($this->requirementsFail()) {
return;
}
parent::testRemoveBin();
}
}

Some files were not shown because too many files have changed in this diff Show more