Skip to content

Commit

Permalink
Updating missing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
hernani.borgesdefreitas committed Sep 21, 2016
1 parent deaf7dc commit b1570db
Show file tree
Hide file tree
Showing 38 changed files with 1,267 additions and 749 deletions.
661 changes: 431 additions & 230 deletions composer.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion docroot/modules/contrib/devel/composer.json
Expand Up @@ -18,5 +18,8 @@
},
"license": "GPL-2.0+",
"minimum-stability": "dev",
"require": { }
"require": { },
"suggest": {
"symfony/var-dumper": "Pretty print complex values better with var-dumper available"
}
}
Expand Up @@ -3,4 +3,7 @@ label: 'Development'
description: 'Links related to Devel module.'
langcode: en
locked: true

dependencies:
enforced:
module:
- devel
22 changes: 10 additions & 12 deletions docroot/modules/contrib/devel/devel.install
Expand Up @@ -5,18 +5,6 @@
* Install, update and uninstall functions for the devel module.
*/

use Drupal\system\Entity\Menu;

/**
* Implements hook_uninstall().
*/
function devel_uninstall() {
// Delete the development menu.
if ($devel_menu = Menu::load('devel')) {
$devel_menu->delete();
}
}

/**
* Set the default devel dumper plugin.
*/
Expand All @@ -30,3 +18,13 @@ function devel_update_8001() {
->set('devel_dumper', $default_dumper)
->save(TRUE);
}

/**
* Add enforced dependencies to system.menu.devel
*/
function devel_update_8002() {
$config = \Drupal::configFactory()->getEditable('system.menu.devel');
$dependencies = $config->get('dependencies');
$dependencies['enforced']['module'][] = 'devel';
$config->set('dependencies', $dependencies)->save(TRUE);
}
7 changes: 5 additions & 2 deletions docroot/modules/contrib/devel/devel.module
Expand Up @@ -47,11 +47,14 @@ function devel_help($route_name) {
function devel_entity_type_alter(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
foreach ($entity_types as $entity_type_id => $entity_type) {
if (($entity_type->getFormClass('default') || $entity_type->getFormClass('edit')) && $entity_type->hasLinkTemplate('edit-form')) {
$entity_type->setLinkTemplate('devel-load', "/devel/$entity_type_id/{{$entity_type_id}}");
}
if ($entity_type->hasViewBuilderClass() && $entity_type->hasLinkTemplate('canonical')) {
$entity_type->setLinkTemplate('devel-render', "/devel/$entity_type_id/{{$entity_type_id}}/render");
}
if (($entity_type->getFormClass('default') || $entity_type->getFormClass('edit')) && $entity_type->hasLinkTemplate('edit-form')) {
$entity_type->setLinkTemplate('devel-load', "/devel/$entity_type_id/{{$entity_type_id}}");
if ($entity_type->hasLinkTemplate('devel-render') || $entity_type->hasLinkTemplate('devel-load')) {
$entity_type->setLinkTemplate('devel-definition', "/devel/$entity_type_id/{{$entity_type_id}}/definition");
}
}
}
Expand Down
Expand Up @@ -60,6 +60,13 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
return array();
}

/**
* {@inheritdoc}
*/
function settingsFormValidate(array $form, FormStateInterface $form_state) {
// Validation is optional.
}

/**
* {@inheritdoc}
*/
Expand Down
Expand Up @@ -49,6 +49,16 @@ function getSettings();
*/
function settingsForm(array $form, FormStateInterface $form_state);

/**
* Form validation handler.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
function settingsFormValidate(array $form, FormStateInterface $form_state);

/**
* Execute the instructions in common for all DevelGenerate plugin
*
Expand Down
Expand Up @@ -87,6 +87,15 @@ public function buildForm(array $form, FormStateInterface $form_state) {
return $form;
}

/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$plugin_id = $this->getPluginIdFromRequest();
$instance = $this->getPluginInstance($plugin_id);
$instance->settingsFormValidate($form, $form_state);
}

/**
* {@inheritdoc}
*/
Expand Down
Expand Up @@ -278,6 +278,15 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
return $form;
}

/**
* {@inheritdoc}
*/
function settingsFormValidate(array $form, FormStateInterface $form_state) {
if (!array_filter($form_state->getValue('node_types'))) {
$form_state->setErrorByName('node_types', $this->t('Please select at least one content type'));
}
}

/**
* {@inheritdoc}
*/
Expand Down
Expand Up @@ -96,6 +96,14 @@ public function testDevelGenerate() {
$this->assertText(t('4 users created.'));
$this->assertText(t('Generate process complete.'));

// Tests that if no content types are selected an error message is shown.
$edit = array(
'num' => 4,
'title_length' => 4,
);
$this->drupalPostForm('admin/config/development/generate/content', $edit, t('Generate'));
$this->assertText(t('Please select at least one content type'));

// Creating content.
// First we create a node in order to test the Delete content checkbox.
$this->drupalCreateNode(array('type' => 'article'));
Expand Down
Expand Up @@ -229,20 +229,20 @@ public static function buildNodeInfo($debug_mode) {
}
else {
$tr = 't';
$variables = array('!na' => '{node_access}');
$variables = array('@na' => '{node_access}');
$states = array(
'default' => array(t('default'), 'ok', t('Default record supplied by core in the absence of any other non-empty records; in !na.', $variables)),
'ok' => array(t('ok'), 'ok', t('Highest priority record; in !na.', $variables)),
'removed' => array(t('removed'), '', t('Was removed in @func; not in !na.', $variables + array('@func' => 'hook_node_access_records_alter()'))),
'static' => array(t('static'), 'ok', t('Non-standard record in !na.', $variables)),
'unexpected' => array(t('unexpected'), 'warning', t('The 0/all/0/... record applies to all nodes and all users -- usually it should not be present in !na if any node access module is active!')),
'ignored' => array(t('ignored'), 'warning', t('Lower priority record; not in !na and thus ignored.', $variables)),
'empty' => array(t('empty'), 'warning', t('Does not grant any access, but could block lower priority records; not in !na.', $variables)),
'wrong' => array(t('wrong'), 'error', t('Is rightfully in !na but at least one access flag is wrong!', $variables)),
'missing' => array(t('missing'), 'error', t("Should be in !na but isn't!", $variables)),
'removed!' => array(t('removed!'), 'error', t('Was removed in @func; should NOT be in !na!', $variables + array('@func' => 'hook_node_access_records_alter()'))),
'illegitimate' => array(t('illegitimate'), 'error', t('Should NOT be in !na because of lower priority!', $variables)),
'alien' => array(t('alien'), 'error', t('Should NOT be in !na because of unknown origin!', $variables)),
'default' => array(t('default'), 'ok', t('Default record supplied by core in the absence of any other non-empty records; in @na.', $variables)),
'ok' => array(t('ok'), 'ok', t('Highest priority record; in @na.', $variables)),
'removed' => array(t('removed'), '', t('Was removed in @func; not in @na.', $variables + array('@func' => 'hook_node_access_records_alter()'))),
'static' => array(t('static'), 'ok', t('Non-standard record in @na.', $variables)),
'unexpected' => array(t('unexpected'), 'warning', t('The 0/all/0/... record applies to all nodes and all users -- usually it should not be present in @na if any node access module is active!')),
'ignored' => array(t('ignored'), 'warning', t('Lower priority record; not in @na and thus ignored.', $variables)),
'empty' => array(t('empty'), 'warning', t('Does not grant any access, but could block lower priority records; not in @na.', $variables)),
'wrong' => array(t('wrong'), 'error', t('Is rightfully in @na but at least one access flag is wrong!', $variables)),
'missing' => array(t('missing'), 'error', t("Should be in @na but isn't!", $variables)),
'removed!' => array(t('removed!'), 'error', t('Was removed in @func; should NOT be in @na!', $variables + array('@func' => 'hook_node_access_records_alter()'))),
'illegitimate' => array(t('illegitimate'), 'error', t('Should NOT be in @na because of lower priority!', $variables)),
'alien' => array(t('alien'), 'error', t('Should NOT be in @na because of unknown origin!', $variables)),
);
$active_states = array('default', 'ok', 'static', 'unexpected', 'wrong', 'illegitimate', 'alien');
$headers = array(t('node'), t('prio'), t('status'), t('realm'), t('gid'), t('view'), t('update'), t('delete'), t('explained'));
Expand Down Expand Up @@ -544,10 +544,10 @@ public static function buildNodeInfo($debug_mode) {
);

if ($error_count > 0) {
$variables['!Rebuild_permissions'] = '<a href="' . url('admin/reports/status/rebuild') . '">' . $tr('Rebuild permissions') . '</a>';
$variables['@Rebuild_permissions'] = '<a href="' . url('admin/reports/status/rebuild') . '">' . $tr('Rebuild permissions') . '</a>';
$output[] = array(
'#prefix' => "\n<span class=\"error\">",
'#markup' => t("You have errors in your !na table! You may be able to fix these for now by running !Rebuild_permissions, but this is likely to destroy the evidence and make it impossible to identify the underlying issues. If you don't fix those, the errors will probably come back again. <br /> DON'T do this just yet if you intend to ask for help with this situation.", $variables),
'#markup' => t("You have errors in your @na table! You may be able to fix these for now by running @Rebuild_permissions, but this is likely to destroy the evidence and make it impossible to identify the underlying issues. If you don't fix those, the errors will probably come back again. <br /> DON'T do this just yet if you intend to ask for help with this situation.", $variables),
'#suffix' => "</span><br />\n",
);
}
Expand All @@ -559,23 +559,23 @@ public static function buildNodeInfo($debug_mode) {
$accounts = array();
$variables += array(
//'!username' => '<em class="placeholder">' . theme('username', array('account' => $user)) . '</em>',
'!username' => '<em class="placeholder">' . $user->getDisplayName() . '</em>',
'@username' => '<em class="placeholder">' . $user->getDisplayName() . '</em>',
'%uid' => $user->id(),
);

if (\Drupal::currentUser()->hasPermission('bypass node access')) {
$variables['%bypass_node_access'] = $tr('bypass node access');
$output[] = array(
'#markup' => t('!username has the %bypass_node_access permission and thus full access to all nodes.', $variables),
'#markup' => t('@username has the %bypass_node_access permission and thus full access to all nodes.', $variables),
'#suffix' => '<br />&nbsp;',
);
}
else {
$variables['!list'] = '<div style="margin-left: 2em">' . self::get_grant_list($grants_data['view']) . '</div>';
$variables['@list'] = '<div style="margin-left: 2em">' . self::get_grant_list($grants_data['view']) . '</div>';
$variables['%access'] = 'view';
$output[] = array(
'#prefix' => "\n<div style='text-align: left' title='" . t('These are the grants returned by hook_node_grants() for this user.') . "'>",
'#markup' => t('!username (user %uid) can use these grants (if they are present above) for %access access: !list', $variables),
'#markup' => t('@username (user %uid) can use these grants (if they are present above) for %access access: @list', $variables),
'#suffix' => "</div>\n",
);
$accounts[] = $user;
Expand All @@ -598,7 +598,7 @@ public static function buildNodeInfo($debug_mode) {
'#theme' => 'item_list',
'#items' => $op_items,
'#type' => 'ul',
'#prefix' => t('to node !nid:', array('!nid' => l($nid, 'node/' . $nid))) . "\n<div style='margin-left: 2em'>",
'#prefix' => t('to node @nid:', array('@nid' => l($nid, 'node/' . $nid))) . "\n<div style='margin-left: 2em'>",
'#suffix' => '</div>',
);
}
Expand All @@ -614,11 +614,11 @@ public static function buildNodeInfo($debug_mode) {
'#suffix' => '</div>',
);
}
$variables['!username'] = '<em class="placeholder">' . theme('username', array('account' => $account)) . '</em>';
$variables['@username'] = '<em class="placeholder">' . theme('username', array('account' => $account)) . '</em>';
$output[] = array(
'#prefix' => "\n<div style='text-align: left'>",
'#type' => 'item',
'lead-in' => array('#markup' => t("!username has the following access", $variables) . ' '),
'lead-in' => array('#markup' => t("@username has the following access", $variables) . ' '),
'items' => $account_items,
'#suffix' => "\n</div>\n",
);
Expand Down Expand Up @@ -1102,7 +1102,7 @@ public static function explainAccess($op, NodeInterface $node, AccountInterface
if (!in_array($op, array('view', 'update', 'delete', 'create'), TRUE)) {
return array(
FALSE,
t('!NO: invalid $op', array('!NO' => t('NO'))),
t('@NO: invalid $op', array('@NO' => t('NO'))),
t("'@op' is an invalid operation!", array('@op' => $op)),
);
}
Expand Down Expand Up @@ -1133,25 +1133,25 @@ public static function explainAccess($op, NodeInterface $node, AccountInterface
}

$variables = array(
'!NO' => t('NO'),
'!YES' => t('YES'),
'!bypass_node_access' => t('bypass node access'),
'!access_content' => t('access content'),
'@NO' => t('NO'),
'@YES' => t('YES'),
'@bypass_node_access' => t('bypass node access'),
'@access_content' => t('access content'),
);

if (Drupal::currentUser()->hasPermission('bypass node access')) {
return array(
TRUE,
t('!YES: bypass node access', $variables),
t("!YES: This user has the '!bypass_node_access' permission and may do everything with nodes.", $variables),
t('@YES: bypass node access', $variables),
t("@YES: This user has the '@bypass_node_access' permission and may do everything with nodes.", $variables),
);
}

if (!Drupal::currentUser()->hasPermission('access content')) {
return array(
FALSE,
t('!NO: access content', $variables),
t("!NO: This user does not have the '!access_content' permission and is denied doing anything with content.", $variables),
t('@NO: access content', $variables),
t("@NO: This user does not have the '@access_content' permission and is denied doing anything with content.", $variables),
);
}

Expand Down Expand Up @@ -1185,30 +1185,30 @@ public static function explainAccess($op, NodeInterface $node, AccountInterface
);
return [
FALSE,
t('!NO: by %module', $variables),
t('@NO: by %module', $variables),
empty($allowed_by)
? t("!NO: hook_node_access() of the following module(s) denies this: @deniers.", $variables)
: t("!NO: hook_node_access() of the following module(s) denies this: @deniers &ndash; even though the following module(s) would allow it: @allowers.", $variables),
? t("@NO: hook_node_access() of the following module(s) denies this: @deniers.", $variables)
: t("@NO: hook_node_access() of the following module(s) denies this: @deniers &ndash; even though the following module(s) would allow it: @allowers.", $variables),
];
}
if (!empty($allowed_by)) {
$variables += array(
'%module' => $allowed_by[0] . (count($allowed_by) > 1 ? '+' : ''),
'!view_own_unpublished_content' => t('view own unpublished content'),
'@view_own_unpublished_content' => t('view own unpublished content'),
);
return array(
TRUE,
t('!YES: by %module', $variables),
t("!YES: hook_node_access() of the following module(s) allows this: @allowers.", $variables),
t('@YES: by %module', $variables),
t("@YES: hook_node_access() of the following module(s) allows this: @allowers.", $variables),
);
}

// TODO if ($op == 'view' && !$node->get('status', $langcode) && \Drupal::currentUser()->hasPermission('view own unpublished content') && $user->uid == $node->get('uid', $langcode) && $user->uid != 0) {
if ($op == 'view' && !$node->isPublished() && Drupal::currentUser()->hasPermission('view own unpublished content') && $user->id() == $node->getRevisionAuthor()->id() && $user->id() != 0) {
return array(
TRUE,
t('!YES: view own unpublished content', $variables),
t("!YES: The node is unpublished, but the user has the '!view_own_unpublished_content' permission.", $variables),
t('@YES: view own unpublished content', $variables),
t("@YES: The node is unpublished, but the user has the '@view_own_unpublished_content' permission.", $variables),
);
}

Expand All @@ -1220,16 +1220,16 @@ public static function explainAccess($op, NodeInterface $node, AccountInterface
$variables['@node_access_table'] = '{node_access}';
return array(
TRUE,
t('!YES: @node_access_table', $variables),
t('!YES: Node access allows this based on one or more records in the @node_access_table table (see the other DNA block!).', $variables),
t('@YES: @node_access_table', $variables),
t('@YES: Node access allows this based on one or more records in the @node_access_table table (see the other DNA block!).', $variables),
);
}
}

return array(
FALSE,
t('!NO: no reason', $variables),
t("!NO: None of the checks resulted in allowing this, so it's denied.", $variables)
t('@NO: no reason', $variables),
t("@NO: None of the checks resulted in allowing this, so it's denied.", $variables)
. ($op == 'create' ? ' ' . t('This is most likely due to a withheld permission.') : ''),
);
}
Expand Down
5 changes: 3 additions & 2 deletions docroot/modules/contrib/devel/drush/phpstorm.drush.inc
Expand Up @@ -64,9 +64,10 @@ function drush_phpstorm_metadata() {
}

// Entity Manager - getStorage
foreach (\Drupal::entityManager()->getDefinitions() as $type => $definition) {
$class = Drupal::entityManager()->getStorage($type);
foreach (\Drupal::entityTypeManager()->getDefinitions() as $type => $definition) {
$class = Drupal::entityTypeManager()->getStorage($type);
$map["\\Drupal::entityManager()->getStorage('')"][$type] = '\\' . get_class($class);
$map["\\Drupal::entityTypeManager()->getStorage('')"][$type] = '\\' . get_class($class);
}

$content = _drush_phpstorm_metadata_phpstorm_metadata_template($map);
Expand Down

0 comments on commit b1570db

Please sign in to comment.