本文整理汇总了PHP中Drupal\Core\Url::fromRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::fromRoute方法的具体用法?PHP Url::fromRoute怎么用?PHP Url::fromRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Url
的用法示例。
在下文中一共展示了Url::fromRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$forum_config = $this->config('forum.settings');
$vid = $forum_config->get('vocabulary');
$vocabulary = $this->entityManager->getStorage('taxonomy_vocabulary')->load($vid);
if (!$vocabulary) {
throw new NotFoundHttpException();
}
// Build base taxonomy term overview.
$form = parent::buildForm($form, $form_state, $vocabulary);
foreach (Element::children($form['terms']) as $key) {
if (isset($form['terms'][$key]['#term'])) {
$term = $form['terms'][$key]['#term'];
$form['terms'][$key]['term']['#url'] = Url::fromRoute('forum.page', ['taxonomy_term' => $term->id()]);
unset($form['terms'][$key]['operations']['#links']['delete']);
$route_parameters = $form['terms'][$key]['operations']['#links']['edit']['url']->getRouteParameters();
if (!empty($term->forum_container->value)) {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit container');
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('entity.taxonomy_term.forum_edit_container_form', $route_parameters);
} else {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit forum');
$form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('entity.taxonomy_term.forum_edit_form', $route_parameters);
}
// We don't want the redirect from the link so we can redirect the
// delete action.
unset($form['terms'][$key]['operations']['#links']['edit']['query']['destination']);
}
}
// Remove the alphabetical reset.
unset($form['actions']['reset_alphabetical']);
// Use the existing taxonomy overview submit handler.
$form['terms']['#empty'] = $this->t('No containers or forums available. <a href="@container">Add container</a> or <a href="@forum">Add forum</a>.', array('@container' => $this->url('forum.add_container'), '@forum' => $this->url('forum.add_forum')));
return $form;
}
示例2: settingsForm
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state)
{
$url = Url::fromRoute('autofloat.settings');
$config_link = \Drupal::l(t('AutoFloat Filter Settings'), $url);
$form['notice'] = array('#markup' => t('!config_link are shared by all the text formats where it is enabled.', array('!config_link' => $config_link)));
return $form;
}
示例3: build
/**
* {@inheritdoc}
*/
public function build()
{
$block = array('#theme' => 'fblikebutton', '#layout' => $this->configuration['layout'], '#show_faces' => $this->configuration['show_faces'], '#action' => $this->configuration['action'], '#font' => $this->configuration['font'], '#color_scheme' => $this->configuration['color_scheme'], '#width' => $this->configuration['iframe_width'], '#height' => $this->configuration['iframe_height'], '#other_css' => $this->configuration['iframe_css'], '#language' => $this->configuration['language']);
// If it's not for the current page
if ($this->configuration['block_url'] != '<current>') {
$block['#url'] = $this->configuration['block_url'];
} else {
// Avoid this block to be cached
$block['#cache'] = array('max-age' => 0);
/**
* Drupal uses the /node path to refers to the frontpage. That's why facebook
* could point to www.example.com/node instead of wwww.example.com.
*
* To avoid this, we check if the current path is the frontpage
*/
// Check if the path is pointing home
if (\Drupal::routeMatch()->getRouteName() == 'view.frontpage.page_1') {
global $base_url;
$block['#url'] = $base_url;
} else {
$block['#url'] = Url::fromRoute('<current>', array(), array('absolute' => true))->toString();
}
}
return $block;
}
示例4: testDrupalRenderFormElements
/**
* Tests rendering form elements without passing through
* \Drupal::formBuilder()->doBuildForm().
*/
function testDrupalRenderFormElements()
{
// Define a series of form elements.
$element = array('#type' => 'button', '#value' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'submit'));
$element = array('#type' => 'textfield', '#title' => $this->randomMachineName(), '#value' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'text'));
$element = array('#type' => 'password', '#title' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'password'));
$element = array('#type' => 'textarea', '#title' => $this->randomMachineName(), '#value' => $this->randomMachineName());
$this->assertRenderedElement($element, '//textarea');
$element = array('#type' => 'radio', '#title' => $this->randomMachineName(), '#value' => FALSE);
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'radio'));
$element = array('#type' => 'checkbox', '#title' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'checkbox'));
$element = array('#type' => 'select', '#title' => $this->randomMachineName(), '#options' => array(0 => $this->randomMachineName(), 1 => $this->randomMachineName()));
$this->assertRenderedElement($element, '//select');
$element = array('#type' => 'file', '#title' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'file'));
$element = array('#type' => 'item', '#title' => $this->randomMachineName(), '#markup' => $this->randomMachineName());
$this->assertRenderedElement($element, '//div[contains(@class, :class) and contains(., :markup)]/label[contains(., :label)]', array(':class' => 'form-type-item', ':markup' => $element['#markup'], ':label' => $element['#title']));
$element = array('#type' => 'hidden', '#title' => $this->randomMachineName(), '#value' => $this->randomMachineName());
$this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'hidden'));
$element = array('#type' => 'link', '#title' => $this->randomMachineName(), '#url' => Url::fromRoute('common_test.destination'), '#options' => array('absolute' => TRUE));
$this->assertRenderedElement($element, '//a[@href=:href and contains(., :title)]', array(':href' => \Drupal::urlGenerator()->generateFromPath('common-test/destination', ['absolute' => TRUE]), ':title' => $element['#title']));
$element = array('#type' => 'details', '#open' => TRUE, '#title' => $this->randomMachineName());
$this->assertRenderedElement($element, '//details/summary[contains(., :title)]', array(':title' => $element['#title']));
$element = array('#type' => 'details', '#open' => TRUE, '#title' => $this->randomMachineName());
$this->assertRenderedElement($element, '//details');
$element['item'] = array('#type' => 'item', '#title' => $this->randomMachineName(), '#markup' => $this->randomMachineName());
$this->assertRenderedElement($element, '//details/div/div[contains(@class, :class) and contains(., :markup)]', array(':class' => 'form-type-item', ':markup' => $element['item']['#markup']));
}
示例5: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
/** @var \Drupal\commerce_tax\Entity\TaxRateInterface $entity */
$operations = parent::getDefaultOperations($entity);
$operations['rate_amounts'] = ['title' => $this->t('View rate amounts'), 'url' => Url::fromRoute('entity.commerce_tax_rate_amount.collection', ['commerce_tax_rate' => $entity->id()])];
return $operations;
}
示例6: hook_toolbar
/**
* Add items to the toolbar menu.
*
* The toolbar is a container for administrative and site-global interactive
* components.
*
* The toolbar provides a common styling for items denoted by the
* .toolbar-tab class.
*
* The toolbar provides a construct called a 'tray'. The tray is a container
* for content. The tray may be associated with a toggle in the administration
* bar. The toggle shows or hides the tray and is optimized for small and
* large screens. To create this association, hook_toolbar() returns one or
* more render elements of type 'toolbar_item', containing the toggle and tray
* elements in its 'tab' and 'tray' properties.
*
* The following properties are available:
* - 'tab': A renderable array.
* - 'tray': Optional. A renderable array.
* - '#weight': Optional. Integer weight used for sorting toolbar items in
* administration bar area.
*
* This hook is invoked in toolbar_pre_render().
*
* @return
* An array of toolbar items, keyed by unique identifiers such as 'home' or
* 'administration', or the short name of the module implementing the hook.
* The corresponding value is a render element of type 'toolbar_item'.
*
* @see toolbar_pre_render()
* @ingroup toolbar_tabs
*/
function hook_toolbar()
{
$items = array();
// Add a search field to the toolbar. The search field employs no toolbar
// module theming functions.
$items['global_search'] = array('#type' => 'toolbar_item', 'tab' => array('#type' => 'search', '#attributes' => array('placeholder' => t('Search the site'), 'class' => array('search-global'))), '#weight' => 200, '#attached' => array('css' => array(drupal_get_path('module', 'search') . '/css/search.base.css')));
// The 'Home' tab is a simple link, which is wrapped in markup associated
// with a visual tab styling.
$items['home'] = array('#type' => 'toolbar_item', 'tab' => array('#type' => 'link', '#title' => t('Home'), '#url' => Url::fromRoute('<front>'), '#options' => array('attributes' => array('title' => t('Home page'), 'class' => array('toolbar-icon', 'toolbar-icon-home')))), '#weight' => -20);
// A tray may be associated with a tab.
//
// When the tab is activated, the tray will become visible, either in a
// horizontal or vertical orientation on the screen.
//
// The tray should contain a renderable array. An optional #heading property
// can be passed. This text is written to a heading tag in the tray as a
// landmark for accessibility.
$items['commerce'] = array('#type' => 'toolbar_item', 'tab' => array('#type' => 'link', '#title' => t('Shopping cart'), '#url' => Url::fromRoute('cart'), '#options' => array('html' => FALSE, 'attributes' => array('title' => t('Shopping cart')))), 'tray' => array('#heading' => t('Shopping cart actions'), 'shopping_cart' => array('#theme' => 'item_list', '#items' => array())), '#weight' => 150);
// The tray can be used to render arbritrary content.
//
// A renderable array passed to the 'tray' property will be rendered outside
// the administration bar but within the containing toolbar element.
//
// If the default behavior and styling of a toolbar tray is not desired, one
// can render content to the toolbar element and apply custom theming and
// behaviors.
$items['user_messages'] = array('#type' => 'toolbar_item', 'tab' => array('#type' => 'link', '#theme' => 'user_message_toolbar_tab', '#theme_wrappers' => array(), '#title' => t('Messages'), '#url' => Url::fromRoute('user.message'), '#options' => array('attributes' => array('title' => t('Messages')))), 'tray' => array('#heading' => t('User messages'), 'messages' => array()), '#weight' => 125);
return $items;
}
示例7: assertBreadcrumbParts
/**
* Assert that a trail exists in the internal browser.
*
* @param array $trail
* An associative array whose keys are expected breadcrumb link paths and
* whose values are expected breadcrumb link texts (not sanitized).
*/
protected function assertBreadcrumbParts($trail)
{
// Compare paths with actual breadcrumb.
$parts = $this->getBreadcrumbParts();
$pass = TRUE;
// There may be more than one breadcrumb on the page. If $trail is empty
// this test would go into an infinite loop, so we need to check that too.
while ($trail && !empty($parts)) {
foreach ($trail as $path => $title) {
// If the path is empty, generate the path from the <front> route. If
// the path does not start with a leading slash, then run it through
// Url::fromUri('base:')->toString() to get the correct base
// prepended.
if ($path == '') {
$url = Url::fromRoute('<front>')->toString();
} elseif ($path[0] != '/') {
$url = Url::fromUri('base:' . $path)->toString();
} else {
$url = $path;
}
$part = array_shift($parts);
$pass = $pass && $part['href'] === $url && $part['text'] === SafeMarkup::checkPlain($title);
}
}
// No parts must be left, or an expected "Home" will always pass.
$pass = $pass && empty($parts);
$this->assertTrue($pass, format_string('Breadcrumb %parts found on @path.', array('%parts' => implode(' » ', $trail), '@path' => $this->getUrl())));
}
示例8: testWatchdog
/**
* Writes a log messages and retrieves it via the REST API.
*/
public function testWatchdog()
{
// Write a log message to the DB.
$this->container->get('logger.channel.rest')->notice('Test message');
// Get the ID of the written message.
$id = db_query_range("SELECT wid FROM {watchdog} WHERE type = :type ORDER BY wid DESC", 0, 1, array(':type' => 'rest'))->fetchField();
// Create a user account that has the required permissions to read
// the watchdog resource via the REST API.
$account = $this->drupalCreateUser(array('restful get dblog'));
$this->drupalLogin($account);
$response = $this->httpRequest(Url::fromRoute('rest.dblog.GET.' . $this->defaultFormat, ['id' => $id, '_format' => $this->defaultFormat]), 'GET');
$this->assertResponse(200);
$this->assertHeader('content-type', $this->defaultMimeType);
$log = Json::decode($response);
$this->assertEqual($log['wid'], $id, 'Log ID is correct.');
$this->assertEqual($log['type'], 'rest', 'Type of log message is correct.');
$this->assertEqual($log['message'], 'Test message', 'Log message text is correct.');
// Request an unknown log entry.
$response = $this->httpRequest(Url::fromRoute('rest.dblog.GET.' . $this->defaultFormat, ['id' => 9999, '_format' => $this->defaultFormat]), 'GET');
$this->assertResponse(404);
$decoded = Json::decode($response);
$this->assertEqual($decoded['message'], 'Log entry with ID 9999 was not found', 'Response message is correct.');
// Make a bad request (a true malformed request would never be a route match).
$response = $this->httpRequest(Url::fromRoute('rest.dblog.GET.' . $this->defaultFormat, ['id' => 0, '_format' => $this->defaultFormat]), 'GET');
$this->assertResponse(400);
$decoded = Json::decode($response);
$this->assertEqual($decoded['message'], 'No log entry ID was provided', 'Response message is correct.');
}
示例9: displayErrorMessages
/**
* Loops through and displays all form errors.
*
* @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.
*/
protected function displayErrorMessages(array $form, FormStateInterface $form_state)
{
$error_links = [];
$errors = $form_state->getErrors();
// Loop through all form errors and check if we need to display a link.
foreach ($errors as $name => $error) {
$form_element = FormElementHelper::getElementByName($name, $form);
$title = FormElementHelper::getElementTitle($form_element);
// Only show links to erroneous elements that are visible.
$is_visible_element = Element::isVisibleElement($form_element);
// Only show links for elements that have a title themselves or have
// children with a title.
$has_title = !empty($title);
// Only show links for elements with an ID.
$has_id = !empty($form_element['#id']);
// Do not show links to elements with suppressed messages. Most often
// their parent element is used for inline errors.
if (!empty($form_element['#error_no_message'])) {
unset($errors[$name]);
} elseif ($is_visible_element && $has_title && $has_id) {
$error_links[] = $this->l($title, Url::fromRoute('<none>', [], ['fragment' => $form_element['#id'], 'external' => TRUE]));
unset($errors[$name]);
}
}
// Set normal error messages for all remaining errors.
foreach ($errors as $error) {
$this->drupalSetMessage($error, 'error');
}
if (!empty($error_links)) {
$render_array = [['#markup' => $this->formatPlural(count($error_links), '1 error has been found: ', '@count errors have been found: ')], ['#theme' => 'item_list', '#items' => $error_links, '#context' => ['list_style' => 'comma-list']]];
$message = $this->renderer->renderPlain($render_array);
$this->drupalSetMessage($message, 'error');
}
}
示例10: testFormSaveDestination
/**
* Tests edit form destinations.
*/
public function testFormSaveDestination()
{
// Create new moderated content in draft.
$this->drupalPostForm('node/add/moderated_content', ['title[0][value]' => 'Some moderated content', 'body[0][value]' => 'First version of the content.'], t('Save as Draft'));
$node = $this->drupalGetNodeByTitle('Some moderated content');
$edit_path = sprintf('node/%d/edit', $node->id());
// After saving, we should be at the canonical URL and viewing the first
// revision.
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('First version of the content.');
// Make a new forward revision; after saving, we should be on the "Latest
// version" tab.
$this->drupalPostForm($edit_path, ['body[0][value]' => 'Second version of the content.'], t('Save and transition to Needs Review'));
$this->assertUrl(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
$this->assertText('Second version of the content.');
// Make a new published revision; after saving, we should be at the
// canonical URL.
$this->drupalPostForm($edit_path, ['body[0][value]' => 'Third version of the content.'], t('Save and transition to Published'));
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('Third version of the content.');
// Make a new forward revision; after saving, we should once again be on the
// "Latest version" tab.
$this->drupalPostForm($edit_path, ['body[0][value]' => 'Fourth version of the content.'], t('Save and create new revision in Draft'));
$this->assertUrl(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
$this->assertText('Fourth version of the content.');
}
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, ProfileInterface $linkit_profile = NULL, $plugin_instance_id = NULL) {
$this->linkitProfile = $linkit_profile;
$this->linkitMatcher = $this->linkitProfile->getMatcher($plugin_instance_id);
$form += $this->linkitMatcher->buildConfigurationForm($form, $form_state);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save changes'),
'#submit' => array('::submitForm'),
'#button_type' => 'primary',
);
$form['actions']['delete'] = array(
'#type' => 'link',
'#title' => $this->t('Delete'),
'#url' => Url::fromRoute('linkit.matcher.delete', [
'linkit_profile' => $this->linkitProfile->id(),
'plugin_instance_id' => $this->linkitMatcher->getUuid(),
]),
'#attributes' => [
'class' => ['button', 'button--danger'],
],
);
return $form;
}
示例12: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$form['help'] = array('#markup' => t('By default, only the "Free order" payment method is listed here. To see additional payment methods you must <a href="@install">install additional modules</a>. The "Payment Method Pack" module that comes with Ubercart provides "Check" and "COD" payment methods. The "Credit Card" module that comes with Ubercart provides a credit card payment method, although you will need an additional module to provide a payment gateway for your credit card. For more information about payment methods and settings please read the <a href="@doc">Ubercart Documentation</a>.', ['@install' => Url::fromRoute('system.modules_list')->toString(), '@doc' => Url::fromUri('http://www.drupal.org/documentation/modules/ubercart')->toString()]));
$form['methods'] = array('#type' => 'table', '#header' => array(t('Payment method'), t('List position'), t('Operations')), '#tabledrag' => array(array('action' => 'order', 'relationship' => 'sibling', 'group' => 'uc-payment-method-weight')));
foreach ($this->paymentMethodManager->getDefinitions() as $id => $method) {
$form['methods'][$id]['#attributes']['class'][] = 'draggable';
$form['methods'][$id]['status'] = array('#type' => 'checkbox', '#title' => SafeMarkup::checkPlain($method['name']), '#default_value' => $method['checkout']);
$form['methods'][$id]['weight'] = array('#type' => 'weight', '#title' => t('Weight for @title', array('@title' => $method['name'])), '#title_display' => 'invisible', '#default_value' => $method['weight'], '#attributes' => array('class' => array('uc-payment-method-weight')));
if (empty($method['no_gateway'])) {
$gateways = _uc_payment_gateway_list($id, TRUE);
$options = array();
foreach ($gateways as $gateway_id => $gateway) {
$options[$gateway_id] = $gateway['title'];
}
if ($options) {
$form['methods'][$id]['status']['#title'] .= ' (' . t('includes %gateways', array('%gateways' => implode(', ', $options))) . ')';
}
}
$links = array();
if (!empty($method['settings_form'])) {
$links['settings'] = array('title' => t('Settings'), 'url' => Url::fromRoute('uc_payment.method_settings', ['method' => $id]));
}
// $links['conditions'] = array(
// 'title' => t('Conditions'),
// 'url' => Url::fromRoute('admin/store/config/payment/manage/uc_payment_method_', ['method' => $id]),
// );
$form['methods'][$id]['settings'] = array('#type' => 'operations', '#links' => $links);
}
return parent::buildForm($form, $form_state);
}
示例13: testTranslatedBreadcrumbs
/**
* Test translated breadcrumbs.
*/
public function testTranslatedBreadcrumbs()
{
// Ensure non-translated breadcrumb is correct.
$breadcrumb = array(Url::fromRoute('<front>')->toString() => 'Home');
foreach ($this->terms as $term) {
$breadcrumb[$term->url()] = $term->label();
}
// The last item will not be in the breadcrumb.
array_pop($breadcrumb);
// Check the breadcrumb on the leaf term page.
$term = $this->getLeafTerm();
$this->assertBreadcrumb($term->urlInfo(), $breadcrumb, $term->label());
$languages = \Drupal::languageManager()->getLanguages();
// Construct the expected translated breadcrumb.
$breadcrumb = array(Url::fromRoute('<front>', [], ['language' => $languages[$this->translateToLangcode]])->toString() => 'Home');
foreach ($this->terms as $term) {
$translated = $term->getTranslation($this->translateToLangcode);
$url = $translated->url('canonical', ['language' => $languages[$this->translateToLangcode]]);
$breadcrumb[$url] = $translated->label();
}
array_pop($breadcrumb);
// Check for the translated breadcrumb on the translated leaf term page.
$term = $this->getLeafTerm();
$translated = $term->getTranslation($this->translateToLangcode);
$this->assertBreadcrumb($translated->urlInfo('canonical', ['language' => $languages[$this->translateToLangcode]]), $breadcrumb, $translated->label());
}
示例14: testCacheContext
/**
* Tests \Drupal\Core\Cache\Context\SessionExistsCacheContext::getContext().
*/
public function testCacheContext()
{
$this->dumpHeaders = TRUE;
// 1. No session (anonymous).
$this->assertSessionCookieOnClient(FALSE);
$this->drupalGet(Url::fromRoute('<front>'));
$this->assertSessionCookieOnClient(FALSE);
$this->assertRaw('Session does not exist!');
$this->assertRaw('[session.exists]=0');
// 2. Session (authenticated).
$this->assertSessionCookieOnClient(FALSE);
$this->drupalLogin($this->rootUser);
$this->assertSessionCookieOnClient(TRUE);
$this->assertRaw('Session exists!');
$this->assertRaw('[session.exists]=1');
$this->drupalLogout();
$this->assertSessionCookieOnClient(FALSE);
$this->assertRaw('Session does not exist!');
$this->assertRaw('[session.exists]=0');
// 3. Session (anonymous).
$this->assertSessionCookieOnClient(FALSE);
$this->drupalGet(Url::fromRoute('<front>', [], ['query' => ['trigger_session' => 1]]));
$this->assertSessionCookieOnClient(TRUE);
$this->assertRaw('Session does not exist!');
$this->assertRaw('[session.exists]=0');
$this->drupalGet(Url::fromRoute('<front>'));
$this->assertSessionCookieOnClient(TRUE);
$this->assertRaw('Session exists!');
$this->assertRaw('[session.exists]=1');
}
示例15: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$fblikebutton_node_options = node_type_get_names();
$config = $this->config('fblikebutton.settings');
$form['fblikebutton_dynamic_visibility'] = array('#type' => 'details', '#title' => $this->t('Visibility settings'), '#open' => TRUE);
$form['fblikebutton_dynamic_visibility']['fblikebutton_node_types'] = array('#type' => 'checkboxes', '#title' => $this->t('Display the Like button on these content types:'), '#options' => $fblikebutton_node_options, '#default_value' => $config->get('node_types'), '#description' => $this->t('Each of these content types will have the "like" button automatically added to them.'));
/**
* @TODO: Uncomment this when the module is also able to add the button to
* the links area
*
$form['fblikebutton_dynamic_visibility']['fblikebutton_full_node_display'] = array(
'#type' => 'radios',
'#title' => $this->t('Where do you want to show the Like button (full node view)?'),
'#options' => array(
$this->t('Content area'),
$this->t('Links area')
),
'#default_value' => $config->get('full_node_display'),
'#description' => $this->t('If <em>Content area</em> is selected, the button will appear in the same area as the node content. When you select <em>Links area</em> the Like button will be visible in the links area, usually at the bottom of the node (When you select this last option you may want to adjust the Appearance settings). You can also configure Static Like Button Blocks in'. \Drupal::l($this->t('block page'), Url::fromRoute('block.admin_display')) . '.'),
);
*/
$form['fblikebutton_dynamic_visibility']['fblikebutton_teaser_display'] = array('#type' => 'radios', '#title' => $this->t('Where do you want to show the Like button on teasers?'), '#options' => array($this->t('Don\'t show on teasers'), $this->t('Content area')), '#default_value' => $config->get('teaser_display'), '#description' => $this->t('If you want to show the like button on teasers you can select the display area.'));
$form['fblikebutton_dynamic_appearance'] = array('#type' => 'details', '#title' => $this->t('Appearance settings'), '#open' => TRUE);
$form['fblikebutton_dynamic_appearance']['fblikebutton_layout'] = array('#type' => 'select', '#title' => $this->t('Layout style'), '#options' => array('standard' => $this->t('Standard'), 'box_count' => $this->t('Box Count'), 'button_count' => $this->t('Button Count'), 'button' => $this->t('Button')), '#default_value' => $config->get('layout'), '#description' => $this->t('Determines the size and amount of social context next to the button.'));
// The actial values passed in from the options will be converted to a boolean
// in the validation function, so it doesn't really matter what we use.
$form['fblikebutton_dynamic_appearance']['fblikebutton_show_faces'] = array('#type' => 'select', '#title' => $this->t('Show faces in the box?'), '#options' => array(t('Do not show faces'), $this->t('Show faces')), '#default_value' => $config->get('show_faces', TRUE), '#description' => $this->t('Show profile pictures below the button. Only works if <em>Layout style</em> (found above) is set to <em>Standard</em> (otherwise, value is ignored).'));
$form['fblikebutton_dynamic_appearance']['fblikebutton_action'] = array('#type' => 'select', '#title' => $this->t('Verb to display'), '#options' => array('like' => $this->t('Like'), 'recommend' => $this->t('Recommend')), '#default_value' => $config->get('action'), '#description' => $this->t('The verbiage to display inside the button itself.'));
$form['fblikebutton_dynamic_appearance']['fblikebutton_font'] = array('#type' => 'select', '#title' => $this->t('Font'), '#options' => array('arial' => 'Arial', 'lucida+grande' => 'Lucida Grande', 'segoe+ui' => 'Segoe UI', 'tahoma' => 'Tahoma', 'trebuchet+ms' => 'Trebuchet MS', 'verdana' => 'Verdana'), '#default_value' => $config->get('font', 'arial'), '#description' => $this->t('The font with which to display the text of the button.'));
$form['fblikebutton_dynamic_appearance']['fblikebutton_color_scheme'] = array('#type' => 'select', '#title' => $this->t('Color scheme'), '#options' => array('light' => $this->t('Light'), 'dark' => $this->t('Dark')), '#default_value' => $config->get('color_scheme'), '#description' => $this->t('The color scheme of the box environtment.'));
$form['fblikebutton_dynamic_appearance']['fblikebutton_weight'] = array('#type' => 'number', '#title' => $this->t('Weight'), '#default_value' => $config->get('weight'), '#description' => $this->t('The weight determines where, at the content block, the like button will appear. The larger the weight, the lower it will appear on the node. For example, if you want the button to appear more toward the top of the node, choose <em>-40</em> as opposed to <em>-39, -38, 0, 1,</em> or <em>50,</em> etc. To position the Like button in its own block, go to the ' . \Drupal::l($this->t('block page'), Url::fromRoute('block.admin_display')) . '.'));
$form['fblikebutton_dynamic_appearance']['fblikebutton_language'] = array('#type' => 'textfield', '#title' => $this->t('Language'), '#default_value' => $config->get('language'), '#description' => $this->t('Specific language to use. Default is English. Examples:<br />French (France): <em>fr_FR</em><br />French (Canada): <em>fr_CA</em><br />More information can be found at http://developers.facebook.com/docs/internationalization/ and a full XML list can be found at http://www.facebook.com/translations/FacebookLocales.xml'));
return parent::buildForm($form, $form_state);
}