当前位置: 首页>>代码示例>>PHP>>正文


PHP UserInterface::urlInfo方法代码示例

本文整理汇总了PHP中Drupal\user\UserInterface::urlInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::urlInfo方法的具体用法?PHP UserInterface::urlInfo怎么用?PHP UserInterface::urlInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\user\UserInterface的用法示例。


在下文中一共展示了UserInterface::urlInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doUserRdfaTests

 /**
  * Tests that user data is exposed on user page.
  */
 protected function doUserRdfaTests()
 {
     $this->drupalLogin($this->rootUser);
     // Feed the HTML into the parser.
     $graph = $this->getRdfGraph($this->adminUser->urlInfo());
     // User type.
     $this->assertEqual($graph->type($this->authorUri), 'schema:Person', "User type was found (schema:Person) on user page.");
     // User name.
     $expected_value = array('type' => 'literal', 'value' => $this->adminUser->label());
     $this->assertTrue($graph->hasProperty($this->authorUri, 'http://schema.org/name', $expected_value), "User name was found (schema:name) on user page.");
     $this->drupalLogout();
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:15,代码来源:StandardProfileTest.php

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Cancel account immediately, if the current user has administrative
     // privileges, no confirmation mail shall be sent, and the user does not
     // attempt to cancel the own account.
     if (!$form_state->isValueEmpty('access') && $form_state->isValueEmpty('user_cancel_confirm') && $this->entity->id() != $this->currentUser()->id()) {
         user_cancel($form_state->getValues(), $this->entity->id(), $form_state->getValue('user_cancel_method'));
         $form_state->setRedirectUrl($this->entity->urlInfo('collection'));
     } else {
         // Store cancelling method and whether to notify the user in
         // $this->entity for
         // \Drupal\user\Controller\UserController::confirmCancel().
         $this->entity->user_cancel_method = $form_state->getValue('user_cancel_method');
         $this->entity->user_cancel_notify = $form_state->getValue('user_cancel_notify');
         $this->entity->save();
         _user_mail_notify('cancel_confirm', $this->entity);
         drupal_set_message($this->t('A confirmation request to cancel your account has been sent to your email address.'));
         $this->logger('user')->notice('Sent account cancellation request to %name %email.', array('%name' => $this->entity->label(), '%email' => '<' . $this->entity->getEmail() . '>'));
         $form_state->setRedirect('entity.user.canonical', array('user' => $this->entity->id()));
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:24,代码来源:UserCancelForm.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, array &$form_state)
 {
     $user = $this->currentUser();
     $this->cancelMethods = user_cancel_methods();
     // Display account cancellation method selection, if allowed.
     $admin_access = $user->hasPermission('administer users');
     $form['user_cancel_method'] = array('#type' => 'radios', '#title' => $this->entity->id() == $user->id() ? $this->t('When cancelling your account') : $this->t('When cancelling the account'), '#access' => $admin_access || $user->hasPermission('select account cancellation method'));
     $form['user_cancel_method'] += $this->cancelMethods;
     // Allow user administrators to skip the account cancellation confirmation
     // mail (by default), as long as they do not attempt to cancel their own
     // account.
     $override_access = $admin_access && $this->entity->id() != $user->id();
     $form['user_cancel_confirm'] = array('#type' => 'checkbox', '#title' => $this->t('Require email confirmation to cancel account.'), '#default_value' => !$override_access, '#access' => $override_access, '#description' => $this->t('When enabled, the user must confirm the account cancellation via email.'));
     // Also allow to send account canceled notification mail, if enabled.
     $default_notify = $this->config('user.settings')->get('notify.status_canceled');
     $form['user_cancel_notify'] = array('#type' => 'checkbox', '#title' => $this->t('Notify user when account is canceled.'), '#default_value' => $override_access ? FALSE : $default_notify, '#access' => $override_access && $default_notify, '#description' => $this->t('When enabled, the user will receive an email notification after the account has been canceled.'));
     // Always provide entity id in the same form key as in the entity edit form.
     $form['uid'] = array('#type' => 'value', '#value' => $this->entity->id());
     $form = parent::buildForm($form, $form_state);
     // @todo Convert to getCancelRoute() after https://drupal.org/node/1987896.
     $form['actions']['cancel'] += $this->entity->urlInfo()->toRenderArray();
     return $form;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:26,代码来源:UserCancelForm.php

示例4: urlInfo

 /**
  * {@inheritdoc}
  */
 public function urlInfo($rel = 'canonical', array $options = array())
 {
     return $this->subject->urlInfo($rel, $options);
 }
开发者ID:mosswoodcreative,项目名称:d8-api-test,代码行数:7,代码来源:TokenAuthUser.php

示例5: getCancelUrl

 /**
  * {@inheritdoc}
  */
 public function getCancelUrl()
 {
     return $this->entity->urlInfo();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:UserCancelForm.php

示例6: testContactStorage


//.........这里部分代码省略.........
    }

    // Make sure the stored message is correct.
    $this->drupalGet('admin/structure/contact/messages');
    $this->clickLink(t('Edit'));
    $this->assertFieldById('edit-name', 'Test_name');
    $this->assertFieldById('edit-mail', $mail);
    $this->assertFieldById('edit-subject-0-value', 'Test_subject');
    $this->assertFieldById('edit-message-0-value', 'Test_message');
    // Submit should redirect back to listing.
    $this->drupalPostForm(NULL, array(), t('Save'));
    $this->assertUrl('admin/structure/contact/messages');

    // Delete the message.
    $this->clickLink(t('Delete'));
    $this->drupalPostForm(NULL, NULL, t('Delete'));
    $this->assertRaw(t('The @entity-type %label has been deleted.', [
      // See \Drupal\Core\Entity\EntityDeleteFormTrait::getDeletionMessage().
      '@entity-type' => 'contact message',
      '%label'       => 'Test_subject',
    ]));
    // Make sure no messages are available.
    $this->assertText('There is no Contact message yet.');

    // Fill the redirect field and assert the page is successfully redirected.
    $edit = ['contact_storage_uri' => 'entity:user/' . $this->adminUser->id()];
    $this->drupalPostForm('admin/structure/contact/manage/test_id', $edit, t('Save'));
    $edit = [
      'subject[0][value]' => 'Test subject',
      'message[0][value]' => 'Test message',
    ];
    $this->drupalPostForm('contact', $edit, t('Send message'));
    $this->assertText('Your message has been sent.');
    $this->assertEqual($this->url, $this->adminUser->urlInfo()->setAbsolute()->toString());

    // Check that this new message is now in HTML format.
    $captured_emails = $this->drupalGetMails();
    $this->assertTrue(strpos($captured_emails[1]['headers']['Content-Type'], 'text/html') !== FALSE);

    // Fill the "Submit button text" field and assert the form can still be
    // submitted.
    $edit = [
      'contact_storage_submit_text' => 'Submit the form',
      'contact_storage_preview' => FALSE,
    ];
    $this->drupalPostForm('admin/structure/contact/manage/test_id', $edit, t('Save'));
    $edit = [
      'subject[0][value]' => 'Test subject',
      'message[0][value]' => 'Test message',
    ];
    $this->drupalGet('contact');
    $element = $this->cssSelect('#edit-preview');
    // Preview button is hidden.
    $this->assertTrue(empty($element));
    $this->drupalPostForm(NULL, $edit, t('Submit the form'));
    $this->assertText('Your message has been sent.');

    // Add an Options email item field to the form.
    $settings = array('settings[allowed_values]' => "test_key1|test_label1|simpletest1@example.com\ntest_key2|test_label2|simpletest2@example.com");
    $this->fieldUIAddNewField('admin/structure/contact/manage/test_id', 'category', 'Category', 'contact_storage_options_email', $settings);
    // Verify that the new field shows up correctly on the form.
    $this->drupalGet('contact');
    $this->assertText('Category');
    $this->assertOption('edit-field-category', '_none');
    $this->assertOption('edit-field-category', 'test_key1');
    $this->assertOption('edit-field-category', 'test_key2');
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:67,代码来源:ContactStorageTest.php


注:本文中的Drupal\user\UserInterface::urlInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。