/**
  * {@inheritdoc}
  */
 public function format(array $message)
 {
     if (is_array($message['body'])) {
         $message['body'] = implode("\n\n", $message['body']);
     }
     if (preg_match('/plain/', $message['headers']['Content-Type'])) {
         if (!($format = \Drupal::config('mimemail.settings')->get('format'))) {
             $format = filter_fallback_format();
         }
         $message['body'] = check_markup($message['body'], $format);
     }
     /*$engine = variable_get('mimemail_engine', 'mimemail');
         //$mailengine = $engine . '_mailengine';
         $engine_prepare_message = $engine . '_prepare_message';
     
         if (function_exists($engine_prepare_message)) {
           $message = $engine_prepare_message($message);
         }
         else {
           $message = mimemail_prepare_message($message);
         }*/
     // @TODO set mimemail_engine. For the moment let's prepare the message.
     $message = $this->prepareMessage($message);
     return $message;
 }
Пример #2
0
 /**
  * Tests text without format.
  *
  * Tests if text with no format is filtered the same way as text in the
  * fallback format.
  */
 function testCheckMarkupNoFormat()
 {
     // Create some text. Include some HTML and line breaks, so we get a good
     // test of the filtering that is applied to it.
     $text = "<strong>" . $this->randomMachineName(32) . "</strong>\n\n<div>" . $this->randomMachineName(32) . "</div>";
     // Make sure that when this text is run through check_markup() with no text
     // format, it is filtered as though it is in the fallback format.
     $this->assertEqual(check_markup($text), check_markup($text, filter_fallback_format()), 'Text with no format is filtered the same as text in the fallback format.');
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public static function generateSampleValue(FieldDefinitionInterface $field_definition)
 {
     $random = new Random();
     $settings = $field_definition->getSettings();
     if (empty($settings['max_length'])) {
         // Textarea handling
         $value = $random->paragraphs();
     } else {
         // Textfield handling.
         $value = substr($random->sentences(mt_rand(1, $settings['max_length'] / 3), FALSE), 0, $settings['max_length']);
     }
     $values = array('value' => $value, 'summary' => $value, 'format' => filter_fallback_format());
     return $values;
 }
Пример #4
0
 public function generateValues($object, $instance, $plugin_definition, $form_display_options)
 {
     $object_field = array();
     $settings = $instance->getSettings();
     if (!empty($settings['text_processing'])) {
         $formats = filter_formats();
         $format = array_rand($formats);
     } else {
         $format = filter_fallback_format();
     }
     if (empty($settings['max_length'])) {
         // Textarea handling
         $object_field['value'] = DevelGenerateBase::createContent($format);
         if ($form_display_options['type'] == 'text_textarea_with_summary' && !empty($settings['display_summary'])) {
             $object_field['summary'] = DevelGenerateBase::createContent($format);
         }
     } else {
         // Textfield handling.
         $object_field['value'] = substr(DevelGenerateBase::createGreeking(mt_rand(1, $settings['max_length'] / 6), FALSE), 0, $settings['max_length']);
     }
     $object_field['format'] = $format;
     return $object_field;
 }
Пример #5
0
 /**
  * Generates taxonomy terms for a list of given vocabularies.
  *
  * @param $records
  *   int number of terms to create in total.
  * @param \Drupal\taxonomy\TermInterface[] $vocabs
  *   array list of vocabs to populate.
  * @param int $maxlength
  *   int maximum length per term.
  * @return array the list of names of the created terms.
  * array the list of names of the created terms.
  */
 function generateTerms($records, $vocabs, $maxlength = 12)
 {
     $terms = array();
     // Insert new data:
     $max = db_query('SELECT MAX(tid) FROM {taxonomy_term_data}')->fetchField();
     $start = time();
     for ($i = 1; $i <= $records; $i++) {
         $values = array();
         switch ($i % 2) {
             case 1:
                 // Set vid and vocabulary_machine_name properties.
                 $vocab = $vocabs[array_rand($vocabs)];
                 $values['vid'] = $values['vocabulary_machine_name'] = $vocab->id();
                 $values['parent'] = array(0);
                 break;
             default:
                 while (TRUE) {
                     // Keep trying to find a random parent.
                     $candidate = mt_rand(1, $max);
                     $query = db_select('taxonomy_term_data', 't');
                     $parent = $query->fields('t', array('tid', 'vid'))->condition('t.vid', array_keys($vocabs), 'IN')->condition('t.tid', $candidate, '>=')->range(0, 1)->execute()->fetchAssoc();
                     if ($parent['tid']) {
                         break;
                     }
                 }
                 $values['parent'] = array($parent['tid']);
                 // Slight speedup due to this property being set.
                 $values['vocabulary_machine_name'] = $parent['vid'];
                 $values['vid'] = $parent['vid'];
                 break;
         }
         $values['name'] = $this->getRandom()->word(mt_rand(2, $maxlength));
         $values['description'] = 'description of ' . $values['name'];
         $values['format'] = filter_fallback_format();
         $values['weight'] = mt_rand(0, 10);
         $values['langcode'] = Language::LANGCODE_NOT_SPECIFIED;
         $term = entity_create('taxonomy_term', $values);
         // Populate all fields with sample values.
         $this->populateFields($term);
         if ($status = $term->save()) {
             $max += 1;
             if (function_exists('drush_log')) {
                 $feedback = drush_get_option('feedback', 1000);
                 if ($i % $feedback == 0) {
                     $now = time();
                     drush_log(dt('Completed !feedback terms (!rate terms/min)', array('!feedback' => $feedback, '!rate' => $feedback * 60 / ($now - $start))), 'ok');
                     $start = $now;
                 }
             }
             // Limit memory usage. Only report first 20 created terms.
             if ($i < 20) {
                 $terms[] = $term->name->value;
             }
             unset($term);
         }
     }
     return $terms;
 }
Пример #6
0
 /**
  * Tests editing a page using a disallowed text format.
  *
  * Verifies that regular users and administrators are able to edit a page, but
  * not allowed to change the fields which use an inaccessible text format.
  * Also verifies that fields which use a text format that does not exist can
  * be edited by administrators only, but that the administrator is forced to
  * choose a new format before saving the page.
  */
 function testFormatWidgetPermissions()
 {
     $body_value_key = 'body[0][value]';
     $body_format_key = 'body[0][format]';
     // Create node to edit.
     $this->drupalLogin($this->adminUser);
     $edit = array();
     $edit['title[0][value]'] = $this->randomMachineName(8);
     $edit[$body_value_key] = $this->randomMachineName(16);
     $edit[$body_format_key] = $this->disallowedFormat->id();
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     // Try to edit with a less privileged user.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/' . $node->id());
     $this->clickLink(t('Edit'));
     // Verify that body field is read-only and contains replacement value.
     $this->assertFieldByXPath("//textarea[@name='{$body_value_key}' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
     // Verify that title can be changed, but preview displays original body.
     $new_edit = array();
     $new_edit['title[0][value]'] = $this->randomMachineName(8);
     $this->drupalPostForm(NULL, $new_edit, t('Preview'));
     $this->assertText($edit[$body_value_key], 'Old body found in preview.');
     // Save and verify that only the title was changed.
     $this->drupalPostForm('node/' . $node->id() . '/edit', $new_edit, t('Save'));
     $this->assertNoText($edit['title[0][value]'], 'Old title not found.');
     $this->assertText($new_edit['title[0][value]'], 'New title found.');
     $this->assertText($edit[$body_value_key], 'Old body found.');
     // Check that even an administrator with "administer filters" permission
     // cannot edit the body field if they do not have specific permission to
     // use its stored format. (This must be disallowed so that the
     // administrator is never forced to switch the text format to something
     // else.)
     $this->drupalLogin($this->filterAdminUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
     $this->assertFieldByXPath("//textarea[@name='{$body_value_key}' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
     // Disable the text format used above.
     $this->disallowedFormat->disable()->save();
     $this->resetFilterCaches();
     // Log back in as the less privileged user and verify that the body field
     // is still disabled, since the less privileged user should not be able to
     // edit content that does not have an assigned format.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
     $this->assertFieldByXPath("//textarea[@name='{$body_value_key}' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
     // Log back in as the filter administrator and verify that the body field
     // can be edited.
     $this->drupalLogin($this->filterAdminUser);
     $this->drupalGet('node/' . $node->id() . '/edit');
     $this->assertNoFieldByXPath("//textarea[@name='{$body_value_key}' and @disabled='disabled']", NULL, 'Text format access denied message not found.');
     $this->assertFieldByXPath("//select[@name='{$body_format_key}']", NULL, 'Text format selector found.');
     // Verify that trying to save the node without selecting a new text format
     // produces an error message, and does not result in the node being saved.
     $old_title = $new_edit['title[0][value]'];
     $new_title = $this->randomMachineName(8);
     $edit = array();
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertText(t('@name field is required.', array('@name' => t('Text format'))), 'Error message is displayed.');
     $this->drupalGet('node/' . $node->id());
     $this->assertText($old_title, 'Old title found.');
     $this->assertNoText($new_title, 'New title not found.');
     // Now select a new text format and make sure the node can be saved.
     $edit[$body_format_key] = filter_fallback_format();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertUrl('node/' . $node->id());
     $this->assertText($new_title, 'New title found.');
     $this->assertNoText($old_title, 'Old title not found.');
     // Switch the text format to a new one, then disable that format and all
     // other formats on the site (leaving only the fallback format).
     $this->drupalLogin($this->adminUser);
     $edit = array($body_format_key => $this->allowedFormat->id());
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertUrl('node/' . $node->id());
     foreach (filter_formats() as $format) {
         if (!$format->isFallbackFormat()) {
             $format->disable()->save();
         }
     }
     // Since there is now only one available text format, the widget for
     // selecting a text format would normally not display when the content is
     // edited. However, we need to verify that the filter administrator still
     // is forced to make a conscious choice to reassign the text to a different
     // format.
     $this->drupalLogin($this->filterAdminUser);
     $old_title = $new_title;
     $new_title = $this->randomMachineName(8);
     $edit = array();
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertText(t('@name field is required.', array('@name' => t('Text format'))), 'Error message is displayed.');
     $this->drupalGet('node/' . $node->id());
     $this->assertText($old_title, 'Old title found.');
     $this->assertNoText($new_title, 'New title not found.');
     $edit[$body_format_key] = filter_fallback_format();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertUrl('node/' . $node->id());
     $this->assertText($new_title, 'New title found.');
     $this->assertNoText($old_title, 'Old title not found.');
 }
Пример #7
0
 /**
  * Tests filter administration functionality.
  */
 function testFilterAdmin()
 {
     $first_filter = 'filter_autop';
     $second_filter = 'filter_url';
     $basic = 'basic_html';
     $restricted = 'restricted_html';
     $full = 'full_html';
     $plain = 'plain_text';
     // Check that the fallback format exists and cannot be disabled.
     $this->assertTrue($plain == filter_fallback_format(), 'The fallback format is set to plain text.');
     $this->drupalGet('admin/config/content/formats');
     $this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable', 'Disable link for the fallback format not found.');
     $this->drupalGet('admin/config/content/formats/manage/' . $plain . '/disable');
     $this->assertResponse(403, 'The fallback format cannot be disabled.');
     // Verify access permissions to Full HTML format.
     $full_format = entity_load('filter_format', $full);
     $this->assertTrue($full_format->access('use', $this->adminUser), 'Admin user may use Full HTML.');
     $this->assertFalse($full_format->access('use', $this->webUser), 'Web user may not use Full HTML.');
     // Add an additional tag.
     $edit = array();
     $edit['filters[filter_html][settings][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <quote>';
     $this->drupalPostForm('admin/config/content/formats/manage/' . $restricted, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->drupalGet('admin/config/content/formats/manage/' . $restricted);
     $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Allowed HTML tag added.');
     $elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array(':first' => 'filters[' . $first_filter . '][weight]', ':second' => 'filters[' . $second_filter . '][weight]'));
     $this->assertTrue(!empty($elements), 'Order confirmed in admin interface.');
     // Reorder filters.
     $edit = array();
     $edit['filters[' . $second_filter . '][weight]'] = 1;
     $edit['filters[' . $first_filter . '][weight]'] = 2;
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->drupalGet('admin/config/content/formats/manage/' . $restricted);
     $this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, 'Order saved successfully.');
     $this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, 'Order saved successfully.');
     $elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array(':first' => 'filters[' . $second_filter . '][weight]', ':second' => 'filters[' . $first_filter . '][weight]'));
     $this->assertTrue(!empty($elements), 'Reorder confirmed in admin interface.');
     $filter_format = entity_load('filter_format', $restricted);
     foreach ($filter_format->filters() as $filter_name => $filter) {
         if ($filter_name == $second_filter || $filter_name == $first_filter) {
             $filters[] = $filter_name;
         }
     }
     // Ensure that the second filter is now before the first filter.
     $this->assertEqual($filter_format->filters($second_filter)->weight + 1, $filter_format->filters($first_filter)->weight, 'Order confirmed in configuration.');
     // Add format.
     $edit = array();
     $edit['format'] = Unicode::strtolower($this->randomMachineName());
     $edit['name'] = $this->randomMachineName();
     $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
     $edit['filters[' . $second_filter . '][status]'] = TRUE;
     $edit['filters[' . $first_filter . '][status]'] = TRUE;
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
     filter_formats_reset();
     $format = entity_load('filter_format', $edit['format']);
     $this->assertNotNull($format, 'Format found in database.');
     $this->drupalGet('admin/config/content/formats/manage/' . $format->id());
     $this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', '', 'Role found.');
     $this->assertFieldByName('filters[' . $second_filter . '][status]', '', 'Line break filter found.');
     $this->assertFieldByName('filters[' . $first_filter . '][status]', '', 'Url filter found.');
     // Disable new filter.
     $this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', array(), t('Disable'));
     $this->assertUrl('admin/config/content/formats');
     $this->assertRaw(t('Disabled text format %format.', array('%format' => $edit['name'])), 'Format successfully disabled.');
     // Allow authenticated users on full HTML.
     $format = entity_load('filter_format', $full);
     $edit = array();
     $edit['roles[' . RoleInterface::ANONYMOUS_ID . ']'] = 0;
     $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
     $this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->label())), 'Full HTML format successfully updated.');
     // Switch user.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/add/page');
     $this->assertRaw('<option value="' . $full . '">Full HTML</option>', 'Full HTML filter accessible.');
     // Use basic HTML and see if it removes tags that are not allowed.
     $body = '<em>' . $this->randomMachineName() . '</em>';
     $extra_text = 'text';
     $text = $body . '<random>' . $extra_text . '</random>';
     $edit = array();
     $edit['title[0][value]'] = $this->randomMachineName();
     $edit['body[0][value]'] = $text;
     $edit['body[0][format]'] = $basic;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
     $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit['title[0][value]'])), 'Filtered node created.');
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->assertTrue($node, 'Node found in database.');
     $this->drupalGet('node/' . $node->id());
     $this->assertRaw($body . $extra_text, 'Filter removed invalid tag.');
     // Use plain text and see if it escapes all tags, whether allowed or not.
     // In order to test plain text, we have to enable the hidden variable for
     // "show_fallback_format", which displays plain text in the format list.
     $this->config('filter.settings')->set('always_show_fallback_choice', TRUE)->save();
     $edit = array();
     $edit['body[0][format]'] = $plain;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->drupalGet('node/' . $node->id());
     $this->assertText(SafeMarkup::checkPlain($text), 'The "Plain text" text format escapes all HTML tags.');
     $this->config('filter.settings')->set('always_show_fallback_choice', FALSE)->save();
     // Switch user.
     $this->drupalLogin($this->adminUser);
     // Clean up.
     // Allowed tags.
     $edit = array();
     $edit['filters[filter_html][settings][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
     $this->drupalPostForm('admin/config/content/formats/manage/' . $basic, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->drupalGet('admin/config/content/formats/manage/' . $basic);
     $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Changes reverted.');
     // Full HTML.
     $edit = array();
     $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = FALSE;
     $this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->label())), 'Full HTML format successfully reverted.');
     $this->drupalGet('admin/config/content/formats/manage/' . $full);
     $this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'], 'Changes reverted.');
     // Filter order.
     $edit = array();
     $edit['filters[' . $second_filter . '][weight]'] = 2;
     $edit['filters[' . $first_filter . '][weight]'] = 1;
     $this->drupalPostForm('admin/config/content/formats/manage/' . $basic, $edit, t('Save configuration'));
     $this->assertUrl('admin/config/content/formats');
     $this->drupalGet('admin/config/content/formats/manage/' . $basic);
     $this->assertFieldByName('filters[' . $second_filter . '][weight]', $edit['filters[' . $second_filter . '][weight]'], 'Changes reverted.');
     $this->assertFieldByName('filters[' . $first_filter . '][weight]', $edit['filters[' . $first_filter . '][weight]'], 'Changes reverted.');
 }
 /**
  * {@inheritdoc}
  */
 public function getViewsData()
 {
     $data = parent::getViewsData();
     $data['users']['table']['base']['help'] = t('Users who have created accounts on your site.');
     $data['users']['table']['base']['access query tag'] = 'user_access';
     $data['users']['table']['wizard_id'] = 'user';
     $data['users']['uid']['field']['id'] = 'user';
     $data['users']['uid']['argument']['id'] = 'user_uid';
     $data['users']['uid']['argument'] += array('name table' => 'users_field_data', 'name field' => 'name', 'empty field name' => \Drupal::config('user.settings')->get('anonymous'));
     $data['users']['uid']['filter']['id'] = 'user_name';
     $data['users']['uid']['filter']['title'] = t('Name');
     $data['users']['uid']['relationship'] = array('title' => t('Content authored'), 'help' => t('Relate content to the user who created it. This relationship will create one record for each content item created by the user.'), 'id' => 'standard', 'base' => 'node_field_data', 'base field' => 'uid', 'field' => 'uid', 'label' => t('nodes'));
     $data['users']['uid_raw'] = array('help' => t('The raw numeric user ID.'), 'real field' => 'uid', 'filter' => array('title' => t('The user ID'), 'id' => 'numeric'));
     $data['users']['uid_representative'] = array('relationship' => array('title' => t('Representative node'), 'label' => t('Representative node'), 'help' => t('Obtains a single representative node for each user, according to a chosen sort criterion.'), 'id' => 'groupwise_max', 'relationship field' => 'uid', 'outer field' => 'users.uid', 'argument table' => 'users', 'argument field' => 'uid', 'base' => 'node', 'field' => 'nid', 'relationship' => 'node_field_data:uid'));
     $data['users']['uid_current'] = array('real field' => 'uid', 'title' => t('Current'), 'help' => t('Filter the view to the currently logged in user.'), 'filter' => array('id' => 'user_current', 'type' => 'yes-no'));
     $data['users_field_data']['name']['help'] = t('The user or author name.');
     $data['users_field_data']['name']['field']['id'] = 'user_name';
     $data['users_field_data']['name']['filter']['title'] = t('Name (raw)');
     $data['users_field_data']['name']['filter']['help'] = t('The user or author name. This filter does not check if the user exists and allows partial matching. Does not utilize autocomplete.');
     // Note that this field implements field level access control.
     $data['users_field_data']['mail']['help'] = t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.');
     $data['users_field_data']['mail']['field']['id'] = 'user_mail';
     $data['users']['langcode']['id'] = 'user_language';
     $data['users']['langcode']['help'] = t('Original language of the user information');
     $data['users_field_data']['langcode']['help'] = t('Language of the translation of user information');
     $data['users_field_data']['preferred_langcode']['title'] = t('Preferred language');
     $data['users_field_data']['preferred_langcode']['help'] = t('Preferred language of the user');
     $data['users_field_data']['preferred_admin_langcode']['title'] = t('Preferred admin language');
     $data['users_field_data']['preferred_admin_langcode']['help'] = t('Preferred administrative language of the user');
     $data['users']['view_user'] = array('field' => array('title' => t('Link to user'), 'help' => t('Provide a simple link to the user.'), 'id' => 'user_link', 'click sortable' => FALSE));
     $data['users_field_data']['created_fulldate'] = array('title' => t('Created date'), 'help' => t('Date in the form of CCYYMMDD.'), 'argument' => array('field' => 'created', 'id' => 'date_fulldate'));
     $data['users_field_data']['created_year_month'] = array('title' => t('Created year + month'), 'help' => t('Date in the form of YYYYMM.'), 'argument' => array('field' => 'created', 'id' => 'date_year_month'));
     $data['users_field_data']['created_year'] = array('title' => t('Created year'), 'help' => t('Date in the form of YYYY.'), 'argument' => array('field' => 'created', 'id' => 'date_year'));
     $data['users_field_data']['created_month'] = array('title' => t('Created month'), 'help' => t('Date in the form of MM (01 - 12).'), 'argument' => array('field' => 'created', 'id' => 'date_month'));
     $data['users_field_data']['created_day'] = array('title' => t('Created day'), 'help' => t('Date in the form of DD (01 - 31).'), 'argument' => array('field' => 'created', 'id' => 'date_day'));
     $data['users_field_data']['created_week'] = array('title' => t('Created week'), 'help' => t('Date in the form of WW (01 - 53).'), 'argument' => array('field' => 'created', 'id' => 'date_week'));
     $data['users_field_data']['status']['field']['output formats'] = array('active-blocked' => array(t('Active'), t('Blocked')));
     $data['users_field_data']['status']['filter']['label'] = t('Active');
     $data['users_field_data']['status']['filter']['type'] = 'yes-no';
     $data['users_field_data']['changed']['title'] = t('Updated date');
     $data['users_field_data']['changed_fulldate'] = array('title' => t('Updated date'), 'help' => t('Date in the form of CCYYMMDD.'), 'argument' => array('field' => 'changed', 'id' => 'date_fulldate'));
     $data['users_field_data']['changed_year_month'] = array('title' => t('Updated year + month'), 'help' => t('Date in the form of YYYYMM.'), 'argument' => array('field' => 'changed', 'id' => 'date_year_month'));
     $data['users_field_data']['changed_year'] = array('title' => t('Updated year'), 'help' => t('Date in the form of YYYY.'), 'argument' => array('field' => 'changed', 'id' => 'date_year'));
     $data['users_field_data']['changed_month'] = array('title' => t('Updated month'), 'help' => t('Date in the form of MM (01 - 12).'), 'argument' => array('field' => 'changed', 'id' => 'date_month'));
     $data['users_field_data']['changed_day'] = array('title' => t('Updated day'), 'help' => t('Date in the form of DD (01 - 31).'), 'argument' => array('field' => 'changed', 'id' => 'date_day'));
     $data['users_field_data']['changed_week'] = array('title' => t('Updated week'), 'help' => t('Date in the form of WW (01 - 53).'), 'argument' => array('field' => 'changed', 'id' => 'date_week'));
     unset($data['users_field_data']['signature']);
     unset($data['users_field_data']['signature_format']);
     if (\Drupal::moduleHandler()->moduleExists('filter')) {
         $data['users_field_data']['signature'] = array('title' => t('Signature'), 'help' => t("The user's signature."), 'field' => array('id' => 'markup', 'format' => filter_fallback_format(), 'click sortable' => FALSE), 'filter' => array('id' => 'string'));
     }
     if (\Drupal::moduleHandler()->moduleExists('content_translation')) {
         $data['users']['translation_link'] = array('title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for users.'), 'field' => array('id' => 'content_translation_link'));
     }
     $data['users']['edit_node'] = array('field' => array('title' => t('Link to edit user'), 'help' => t('Provide a simple link to edit the user.'), 'id' => 'user_link_edit', 'click sortable' => FALSE));
     $data['users']['cancel_node'] = array('field' => array('title' => t('Link to cancel user'), 'help' => t('Provide a simple link to cancel the user.'), 'id' => 'user_link_cancel', 'click sortable' => FALSE));
     $data['users']['data'] = array('title' => t('Data'), 'help' => t('Provides access to the user data service.'), 'real field' => 'uid', 'field' => array('id' => 'user_data'));
     $data['users_roles']['table']['group'] = t('User');
     $data['users_roles']['table']['join'] = array('users' => array('left_field' => 'uid', 'field' => 'uid'));
     $data['users_roles']['rid'] = array('title' => t('Roles'), 'help' => t('Roles that a user belongs to.'), 'field' => array('id' => 'user_roles', 'no group by' => TRUE), 'filter' => array('id' => 'user_roles', 'allow empty' => TRUE), 'argument' => array('id' => 'users_roles_rid', 'name table' => 'role', 'name field' => 'name', 'empty field name' => t('No role'), 'zero is null' => TRUE, 'numeric' => TRUE));
     $data['users_roles']['permission'] = array('title' => t('Permission'), 'help' => t('The user permissions.'), 'field' => array('id' => 'user_permissions', 'no group by' => TRUE), 'filter' => array('id' => 'user_permissions', 'real field' => 'rid'));
     return $data;
 }