Update to Drupal 8.0.1. For more information, see https://www.drupal.org/node/2627402
This commit is contained in:
parent
013aaaf2ff
commit
1a0e9d9fac
153 changed files with 1268 additions and 670 deletions
|
@ -237,7 +237,7 @@ class FormattableMarkup implements MarkupInterface, \Countable {
|
|||
if (!ctype_alpha($key[0])) {
|
||||
// We trigger an error as we may want to introduce new placeholders
|
||||
// in the future without breaking backward compatibility.
|
||||
trigger_error('Invalid placeholder: ' . $key, E_USER_ERROR);
|
||||
trigger_error('Invalid placeholder (' . $key . ') in string: ' . $string, E_USER_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ class Xss {
|
|||
switch ($mode) {
|
||||
case 0:
|
||||
// Attribute name, href for instance.
|
||||
if (preg_match('/^([-a-zA-Z]+)/', $attributes, $match)) {
|
||||
if (preg_match('/^([-a-zA-Z][-a-zA-Z0-9]*)/', $attributes, $match)) {
|
||||
$attribute_name = strtolower($match[1]);
|
||||
$skip = ($attribute_name == 'style' || substr($attribute_name, 0, 2) == 'on');
|
||||
|
||||
|
@ -233,7 +233,7 @@ class Xss {
|
|||
));
|
||||
|
||||
$working = $mode = 1;
|
||||
$attributes = preg_replace('/^[-a-zA-Z]+/', '', $attributes);
|
||||
$attributes = preg_replace('/^[-a-zA-Z][-a-zA-Z0-9]*/', '', $attributes);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
|
|||
}
|
||||
// Per the W3C specification at
|
||||
// http://www.w3.org/TR/REC-CSS2/cascade.html#at-import, @import
|
||||
// rules must proceed any other style, so we move those to the
|
||||
// rules must precede any other style, so we move those to the
|
||||
// top.
|
||||
$regexp = '/@import[^;]+;/i';
|
||||
preg_match_all($regexp, $data, $matches);
|
||||
|
|
|
@ -21,9 +21,9 @@ interface AuthenticationProviderChallengeInterface {
|
|||
/**
|
||||
* Constructs an exception which is used to generate the challenge.
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\Request
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The request.
|
||||
* @var \Exception $exception
|
||||
* @param \Exception $previous
|
||||
* The previous exception.
|
||||
*
|
||||
* @return \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|NULL
|
||||
|
|
|
@ -290,7 +290,7 @@ abstract class ConfigBase implements RefinableCacheableDependencyInterface {
|
|||
if ($data instanceof MarkupInterface) {
|
||||
$data = (string) $data;
|
||||
}
|
||||
else if (is_array($data)) {
|
||||
elseif (is_array($data)) {
|
||||
array_walk_recursive($data, function (&$value) {
|
||||
if ($value instanceof MarkupInterface) {
|
||||
$value = (string) $value;
|
||||
|
|
|
@ -54,7 +54,7 @@ class TimestampDatetimeWidget extends WidgetBase {
|
|||
if (isset($item['value']) && $item['value'] instanceof DrupalDateTime) {
|
||||
$date = $item['value'];
|
||||
}
|
||||
else if (isset($item['value']['object']) && $item['value']['object'] instanceof DrupalDateTime) {
|
||||
elseif (isset($item['value']['object']) && $item['value']['object'] instanceof DrupalDateTime) {
|
||||
$date = $item['value']['object'];
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -99,10 +99,10 @@ class TaggedHandlersPass implements CompilerPassInterface {
|
|||
if ($param->getClass()) {
|
||||
$interface = $param->getClass();
|
||||
}
|
||||
else if ($param->getName() === 'id') {
|
||||
elseif ($param->getName() === 'id') {
|
||||
$id_pos = $pos;
|
||||
}
|
||||
else if ($param->getName() === 'priority') {
|
||||
elseif ($param->getName() === 'priority') {
|
||||
$priority_pos = $pos;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -127,8 +127,8 @@ interface DrupalKernelInterface extends HttpKernelInterface, ContainerAwareInter
|
|||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated 8.x
|
||||
* Only used by legacy front-controller scripts.
|
||||
* @deprecated in Drupal 8.0.x and will be removed before 9.0.0. Only used by
|
||||
* legacy front-controller scripts.
|
||||
*/
|
||||
public function prepareLegacyRequest(Request $request);
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ class EntityType implements EntityTypeInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks that the provided class is an instance of ConfigEntityStorage.
|
||||
* Checks that the provided class is compatible with the current entity type.
|
||||
*
|
||||
* @param string $class
|
||||
* The class to check.
|
||||
|
|
|
@ -19,7 +19,8 @@ class KeyValueContentEntityStorage extends KeyValueEntityStorage implements Cont
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) {
|
||||
// @todo
|
||||
// @todo Complete the content entity storage implementation in
|
||||
// https://www.drupal.org/node/2618436.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ class DefaultSelection extends PluginBase implements SelectionInterface, Selecti
|
|||
}
|
||||
|
||||
$options = array();
|
||||
$entities = entity_load_multiple($target_type, $result);
|
||||
$entities = $this->entityManager->getStorage($target_type)->loadMultiple($result);
|
||||
foreach ($entities as $entity_id => $entity) {
|
||||
$bundle = $entity->bundle();
|
||||
$options[$bundle][$entity_id] = Html::escape($entity->label());
|
||||
|
|
|
@ -1051,7 +1051,7 @@ function hook_ENTITY_TYPE_translation_create(\Drupal\Core\Entity\EntityInterface
|
|||
*/
|
||||
function hook_entity_translation_insert(\Drupal\Core\Entity\EntityInterface $translation) {
|
||||
$variables = array(
|
||||
'@language' => $translation->language()->name,
|
||||
'@language' => $translation->language()->getName(),
|
||||
'@label' => $translation->getUntranslated()->label(),
|
||||
);
|
||||
\Drupal::logger('example')->notice('The @language translation of @label has just been stored.', $variables);
|
||||
|
@ -1071,7 +1071,7 @@ function hook_entity_translation_insert(\Drupal\Core\Entity\EntityInterface $tra
|
|||
*/
|
||||
function hook_ENTITY_TYPE_translation_insert(\Drupal\Core\Entity\EntityInterface $translation) {
|
||||
$variables = array(
|
||||
'@language' => $translation->language()->name,
|
||||
'@language' => $translation->language()->getName(),
|
||||
'@label' => $translation->getUntranslated()->label(),
|
||||
);
|
||||
\Drupal::logger('example')->notice('The @language translation of @label has just been stored.', $variables);
|
||||
|
@ -1089,10 +1089,9 @@ function hook_ENTITY_TYPE_translation_insert(\Drupal\Core\Entity\EntityInterface
|
|||
* @see hook_ENTITY_TYPE_translation_delete()
|
||||
*/
|
||||
function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $translation) {
|
||||
$languages = \Drupal::languageManager()->getLanguages();
|
||||
$variables = array(
|
||||
'@language' => $languages[$langcode]->name,
|
||||
'@label' => $entity->label(),
|
||||
'@language' => $translation->language()->getName(),
|
||||
'@label' => $translation->label(),
|
||||
);
|
||||
\Drupal::logger('example')->notice('The @language translation of @label has just been deleted.', $variables);
|
||||
}
|
||||
|
@ -1109,10 +1108,9 @@ function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $tra
|
|||
* @see hook_entity_translation_delete()
|
||||
*/
|
||||
function hook_ENTITY_TYPE_translation_delete(\Drupal\Core\Entity\EntityInterface $translation) {
|
||||
$languages = \Drupal::languageManager()->getLanguages();
|
||||
$variables = array(
|
||||
'@language' => $languages[$langcode]->name,
|
||||
'@label' => $entity->label(),
|
||||
'@language' => $translation->language()->getName(),
|
||||
'@label' => $translation->label(),
|
||||
);
|
||||
\Drupal::logger('example')->notice('The @language translation of @label has just been deleted.', $variables);
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
|
|||
foreach ($reasons as $reason) {
|
||||
$reason_message[] = implode(', ', $reason);
|
||||
}
|
||||
throw new ModuleUninstallValidatorException('The following reasons prevents the modules from being uninstalled: ' . implode('; ', $reason_message));
|
||||
throw new ModuleUninstallValidatorException('The following reasons prevent the modules from being uninstalled: ' . implode('; ', $reason_message));
|
||||
}
|
||||
// Set the actual module weights.
|
||||
$module_list = array_map(function ($module) use ($module_data) {
|
||||
|
|
|
@ -397,8 +397,6 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
|
|||
$field_state = static::getWidgetState($form['#parents'], $field_name, $form_state);
|
||||
|
||||
if ($violations->count()) {
|
||||
$form_builder = \Drupal::formBuilder();
|
||||
|
||||
// Locate the correct element in the form.
|
||||
$element = NestedArray::getValue($form_state->getCompleteForm(), $field_state['array_parents']);
|
||||
|
||||
|
|
|
@ -163,6 +163,9 @@ function hook_ajax_render_alter(array &$data) {
|
|||
* altering a node form, the node entity can be retrieved by invoking
|
||||
* $form_state->getFormObject()->getEntity().
|
||||
*
|
||||
* Implementations are responsible for adding cache contexts/tags/max-age as
|
||||
* needed. See https://www.drupal.org/developing/api/8/cache.
|
||||
*
|
||||
* In addition to hook_form_alter(), which is called for all forms, there are
|
||||
* two more specific form hooks available. The first,
|
||||
* hook_form_BASE_FORM_ID_alter(), allows targeting of a form/forms via a base
|
||||
|
@ -210,6 +213,9 @@ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_stat
|
|||
/**
|
||||
* Provide a form-specific alteration instead of the global hook_form_alter().
|
||||
*
|
||||
* Implementations are responsible for adding cache contexts/tags/max-age as
|
||||
* needed. See https://www.drupal.org/developing/api/8/cache.
|
||||
*
|
||||
* Modules can implement hook_form_FORM_ID_alter() to modify a specific form,
|
||||
* rather than implementing hook_form_alter() and checking the form ID, or
|
||||
* using long switch statements to alter multiple forms.
|
||||
|
@ -249,6 +255,9 @@ function hook_form_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $f
|
|||
/**
|
||||
* Provide a form-specific alteration for shared ('base') forms.
|
||||
*
|
||||
* Implementations are responsible for adding cache contexts/tags/max-age as
|
||||
* needed. See https://www.drupal.org/developing/api/8/cache.
|
||||
*
|
||||
* By default, when \Drupal::formBuilder()->getForm() is called, Drupal looks
|
||||
* for a function with the same name as the form ID, and uses that function to
|
||||
* build the form. In contrast, base forms allow multiple form IDs to be mapped
|
||||
|
|
|
@ -16,6 +16,7 @@ use Drupal\Core\Url;
|
|||
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
|
||||
|
@ -170,6 +171,9 @@ class PathValidator implements PathValidatorInterface {
|
|||
catch (AccessDeniedHttpException $e) {
|
||||
return FALSE;
|
||||
}
|
||||
catch (MethodNotAllowedException $e) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Drupal\Core\PathProcessor;
|
|||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Processes the inbound path by resolving it to the front page if empty.
|
||||
|
@ -41,6 +42,11 @@ class PathProcessorFront implements InboundPathProcessorInterface, OutboundPathP
|
|||
public function processInbound($path, Request $request) {
|
||||
if ($path === '/') {
|
||||
$path = $this->config->get('system.site')->get('page.front');
|
||||
if (empty($path)) {
|
||||
// We have to return a valid path but / won't be routable and config
|
||||
// might be broken so stop execution.
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ use Drupal\Core\Url;
|
|||
* additional information, as well as a list of properties that are common to
|
||||
* all render elements (including form elements). Properties specific to a
|
||||
* particular element are documented on that element's class.
|
||||
|
||||
* Here is a list of properties that are used during the rendering and
|
||||
* form processing of form elements:
|
||||
*
|
||||
* Here is a list of properties that are used during the rendering and form
|
||||
* processing of form elements:
|
||||
* - #after_build: (array) Array of callables or function names, which are
|
||||
* called after the element is built. Arguments: $element, $form_state.
|
||||
* - #ajax: (array) Array of elements to specify Ajax behavior. See
|
||||
|
|
|
@ -190,7 +190,17 @@ class MachineName extends Textfield {
|
|||
}
|
||||
|
||||
$element['#attached']['library'][] = 'core/drupal.machine-name';
|
||||
$element['#attached']['drupalSettings']['machineName']['#' . $source['#id']] = $element['#machine_name'];
|
||||
$options = [
|
||||
'replace_pattern',
|
||||
'replace',
|
||||
'maxlength',
|
||||
'target',
|
||||
'label',
|
||||
'field_prefix',
|
||||
'field_suffix',
|
||||
'suffix',
|
||||
];
|
||||
$element['#attached']['drupalSettings']['machineName']['#' . $source['#id']] = array_intersect_key($element['#machine_name'], array_flip($options));
|
||||
$element['#attached']['drupalSettings']['langcode'] = $language->getId();
|
||||
|
||||
return $element;
|
||||
|
|
|
@ -68,12 +68,12 @@
|
|||
* receives are documented in the header of the default Twig template file.
|
||||
*
|
||||
* hook_theme() implementations can also specify that a theme hook
|
||||
* implementation is a theme function, but that is uncommon. It is only used for
|
||||
* special cases, for performance reasons, because rendering using theme
|
||||
* functions is somewhat faster than theme templates. Note that while Twig
|
||||
* templates will auto-escape variables, theme functions must explicitly escape
|
||||
* any variables by using theme_render_and_autoescape(). Failure to do so is
|
||||
* likely to result in security vulnerabilities.
|
||||
* implementation is a theme function, but that is uncommon and not recommended.
|
||||
* Note that while Twig templates will auto-escape variables, theme functions
|
||||
* must explicitly escape any variables by using theme_render_and_autoescape().
|
||||
* Failure to do so is likely to result in security vulnerabilities. Theme
|
||||
* functions are deprecated in Drupal 8.0.x and will be removed before
|
||||
* Drupal 9.0.x. Use Twig templates instead.
|
||||
*
|
||||
* @section sec_overriding_theme_hooks Overriding Theme Hooks
|
||||
* Themes may register new theme hooks within a hook_theme() implementation, but
|
||||
|
@ -98,7 +98,8 @@
|
|||
* default function is again a good starting point for overriding its behavior.
|
||||
* Again, note that theme functions (unlike templates) must explicitly escape
|
||||
* variables using theme_render_and_autoescape() or risk security
|
||||
* vulnerabilities.
|
||||
* vulnerabilities. Theme functions are deprecated in Drupal 8.0.x and will be
|
||||
* removed before Drupal 9.0.x. Use Twig templates instead.
|
||||
*
|
||||
* @section sec_preprocess_templates Preprocessing for Template Files
|
||||
* If the theme implementation is a template file, several functions are called
|
||||
|
@ -998,7 +999,7 @@ function hook_page_attachments(array &$attachments) {
|
|||
* @param array &$attachments
|
||||
* Array of all attachments provided by hook_page_attachments() implementations.
|
||||
*
|
||||
* @see hook_page_attachments_alter()
|
||||
* @see hook_page_attachments()
|
||||
*/
|
||||
function hook_page_attachments_alter(array &$attachments) {
|
||||
// Conditionally remove an asset.
|
||||
|
@ -1080,8 +1081,7 @@ function hook_page_bottom(array &$page_bottom) {
|
|||
* element or tree in preprocess and process functions.
|
||||
* - file: The file the implementation resides in. This file will be included
|
||||
* prior to the theme being rendered, to make sure that the function or
|
||||
* preprocess function (as needed) is actually loaded; this makes it
|
||||
* possible to split theme functions out into separate files quite easily.
|
||||
* preprocess function (as needed) is actually loaded.
|
||||
* - path: Override the path of the file to be used. Ordinarily the module or
|
||||
* theme path will be used, but if the file will not be in the default
|
||||
* path, include it here. This path should be relative to the Drupal root
|
||||
|
@ -1094,9 +1094,10 @@ function hook_page_bottom(array &$page_bottom) {
|
|||
* specified, a default template name will be assumed. For example, if a
|
||||
* module registers the 'search_result' theme hook, 'search-result' will be
|
||||
* assigned as its template name.
|
||||
* - function: If specified, this will be the function name to invoke for
|
||||
* this implementation. If neither 'template' nor 'function' are specified,
|
||||
* a default template name will be assumed. See above for more details.
|
||||
* - function: (deprecated in Drupal 8.0.x, will be removed in Drupal 9.0.x)
|
||||
* If specified, this will be the function name to invoke for this
|
||||
* implementation. If neither 'template' nor 'function' are specified, a
|
||||
* default template name will be assumed. See above for more details.
|
||||
* - base hook: Used for theme suggestions only: the base theme hook name.
|
||||
* Instead of this suggestion's implementation being used directly, the base
|
||||
* hook will be invoked with this implementation as its first suggestion.
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Routing\LinkGeneratorTrait.
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Link instead.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
@ -37,6 +40,9 @@ trait LinkGeneratorTrait {
|
|||
* @return \Drupal\Core\GeneratedLink
|
||||
* A GeneratedLink object containing a link to the given route and
|
||||
* parameters and bubbleable metadata.
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Link instead.
|
||||
*/
|
||||
protected function l($text, Url $url) {
|
||||
return $this->getLinkGenerator()->generate($text, $url);
|
||||
|
|
|
@ -257,7 +257,7 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
|
|||
if ($number_parts == 1) {
|
||||
$masks = array(1);
|
||||
}
|
||||
elseif ($number_parts <= 3) {
|
||||
elseif ($number_parts <= 3 && $number_parts > 0) {
|
||||
// Optimization - don't query the state system for short paths. This also
|
||||
// insulates against the state entry for masks going missing for common
|
||||
// user-facing paths since we generate all values without checking state.
|
||||
|
@ -272,7 +272,6 @@ class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProv
|
|||
$masks = (array) $this->state->get('routing.menu_masks.' . $this->tableName, array());
|
||||
}
|
||||
|
||||
|
||||
// Only examine patterns that actually exist as router items (the masks).
|
||||
foreach ($masks as $i) {
|
||||
if ($i > $end) {
|
||||
|
|
|
@ -33,7 +33,7 @@ interface StackedRouteMatchInterface extends RouteMatchInterface {
|
|||
/**
|
||||
* Returns the parent route match of the current.
|
||||
*
|
||||
* @return \Drupal\Core\Routing\RouteMatchInterface\NULL
|
||||
* @return \Drupal\Core\Routing\RouteMatchInterface|NULL
|
||||
* The parent route match or NULL, if it the master route match.
|
||||
*/
|
||||
public function getParentRouteMatch();
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Routing\UrlGeneratorTrait.
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Url instead.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
@ -34,6 +37,9 @@ trait UrlGeneratorTrait {
|
|||
*
|
||||
* @return string
|
||||
* The generated URL for the given route.
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Url instead.
|
||||
*/
|
||||
protected function url($route_name, $route_parameters = array(), $options = array()) {
|
||||
return $this->getUrlGenerator()->generateFromRoute($route_name, $route_parameters, $options);
|
||||
|
|
|
@ -43,7 +43,10 @@
|
|||
* by the machine name of the module that defines the route, or the name of
|
||||
* a subsystem.
|
||||
* - The 'path' line gives the URL path of the route (relative to the site's
|
||||
* base URL).
|
||||
* base URL). Note: The path in Drupal is treated case insensitive so
|
||||
* /example and /EXAmplE should return the same page.
|
||||
* @todo Fix https://www.drupal.org/node/2075889 to actually get this
|
||||
* behaviour.
|
||||
* - The 'defaults' section tells how to build the main content of the route,
|
||||
* and can also give other information, such as the page title and additional
|
||||
* arguments for the route controller method. There are several possibilities
|
||||
|
|
|
@ -52,7 +52,7 @@ class StreamWrapperManager extends ContainerAware implements StreamWrapperManage
|
|||
if (isset($this->wrappers[$filter])) {
|
||||
return $this->wrappers[$filter];
|
||||
}
|
||||
else if (isset($this->wrappers[StreamWrapperInterface::ALL])) {
|
||||
elseif (isset($this->wrappers[StreamWrapperInterface::ALL])) {
|
||||
$this->wrappers[$filter] = array();
|
||||
foreach ($this->wrappers[StreamWrapperInterface::ALL] as $scheme => $info) {
|
||||
// Bit-wise filter.
|
||||
|
|
|
@ -77,8 +77,7 @@ trait StringTranslationTrait {
|
|||
/**
|
||||
* Formats a string containing a count of items.
|
||||
*
|
||||
* See the \Drupal\Core\StringTranslation\TranslationInterface::formatPlural()
|
||||
* documentation for details.
|
||||
* @see \Drupal\Core\StringTranslation\TranslationInterface::formatPlural()
|
||||
*/
|
||||
protected function formatPlural($count, $singular, $plural, array $args = array(), array $options = array()) {
|
||||
return $this->getStringTranslation()->formatPlural($count, $singular, $plural, $args, $options);
|
||||
|
@ -87,9 +86,6 @@ trait StringTranslationTrait {
|
|||
/**
|
||||
* Returns the number of plurals supported by a given language.
|
||||
*
|
||||
* See the \Drupal\locale\PluralFormulaInterface::getNumberOfPlurals()
|
||||
* documentation for details.
|
||||
*
|
||||
* @see \Drupal\locale\PluralFormulaInterface::getNumberOfPlurals()
|
||||
*/
|
||||
protected function getNumberOfPlurals($langcode = NULL) {
|
||||
|
|
|
@ -184,7 +184,7 @@ class TranslatableMarkup extends FormattableMarkup {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets all argments from this translated string.
|
||||
* Gets all arguments from this translated string.
|
||||
*
|
||||
* @return mixed[]
|
||||
* The array of arguments.
|
||||
|
|
|
@ -16,20 +16,24 @@ use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
|
|||
class TranslationManager implements TranslationInterface, TranslatorInterface {
|
||||
|
||||
/**
|
||||
* An array of active translators keyed by priority.
|
||||
* An unsorted array of arrays of active translators.
|
||||
*
|
||||
* @var array
|
||||
* Array of \Drupal\Core\StringTranslation\Translator\TranslatorInterface objects
|
||||
* An associative array. The keys are integers that indicate priority. Values
|
||||
* are arrays of TranslatorInterface objects.
|
||||
*
|
||||
* @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface[][]
|
||||
*
|
||||
* @see \Drupal\Core\StringTranslation\TranslationManager::addTranslator()
|
||||
* @see \Drupal\Core\StringTranslation\TranslationManager::sortTranslators()
|
||||
*/
|
||||
protected $translators = array();
|
||||
|
||||
/**
|
||||
* Holds the array of translators sorted by priority.
|
||||
* An array of translators, sorted by priority.
|
||||
*
|
||||
* If this is NULL a rebuild will be triggered.
|
||||
*
|
||||
* @var array
|
||||
* An array of path processor objects.
|
||||
* @var null|\Drupal\Core\StringTranslation\Translator\TranslatorInterface[]
|
||||
*
|
||||
* @see \Drupal\Core\StringTranslation\TranslationManager::addTranslator()
|
||||
* @see \Drupal\Core\StringTranslation\TranslationManager::sortTranslators()
|
||||
|
@ -62,8 +66,7 @@ class TranslationManager implements TranslationInterface, TranslatorInterface {
|
|||
* @param int $priority
|
||||
* The priority of the logger being added.
|
||||
*
|
||||
* @return \Drupal\Core\StringTranslation\TranslationManager
|
||||
* The called object.
|
||||
* @return $this
|
||||
*/
|
||||
public function addTranslator(TranslatorInterface $translator, $priority = 0) {
|
||||
$this->translators[$priority][] = $translator;
|
||||
|
@ -75,8 +78,8 @@ class TranslationManager implements TranslationInterface, TranslatorInterface {
|
|||
/**
|
||||
* Sorts translators according to priority.
|
||||
*
|
||||
* @return array
|
||||
* A sorted array of translators objects.
|
||||
* @return \Drupal\Core\StringTranslation\Translator\TranslatorInterface[]
|
||||
* A sorted array of translator objects.
|
||||
*/
|
||||
protected function sortTranslators() {
|
||||
$sorted = array();
|
||||
|
|
|
@ -438,7 +438,7 @@ class TwigExtension extends \Twig_Extension {
|
|||
$return = $arg->toString();
|
||||
}
|
||||
else {
|
||||
throw new \Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($arg))));
|
||||
throw new \Exception('Object of type ' . get_class($arg) . ' cannot be printed.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ class TwigExtension extends \Twig_Extension {
|
|||
return $arg->toString();
|
||||
}
|
||||
else {
|
||||
throw new \Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($arg))));
|
||||
throw new \Exception('Object of type ' . get_class($arg) . ' cannot be printed.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class TwigNodeVisitor extends \Twig_BaseNodeVisitor {
|
|||
);
|
||||
}
|
||||
// Change the 'escape' filter to our own 'drupal_escape' filter.
|
||||
else if ($node instanceof \Twig_Node_Expression_Filter) {
|
||||
elseif ($node instanceof \Twig_Node_Expression_Filter) {
|
||||
$name = $node->getNode('filter')->getAttribute('value');
|
||||
if ('escape' == $name || 'e' == $name) {
|
||||
// Use our own escape filter that is SafeMarkup aware.
|
||||
|
|
|
@ -15,7 +15,7 @@ use Drupal\Core\TypedData\Type\DateTimeInterface;
|
|||
*
|
||||
* @DataType(
|
||||
* id = "timestamp",
|
||||
* label = @Translation("String")
|
||||
* label = @Translation("Timestamp")
|
||||
* )
|
||||
*/
|
||||
class Timestamp extends IntegerData implements DateTimeInterface {
|
||||
|
|
Reference in a new issue