MoreLink.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/Render/Element/MoreLink.php
  2. 10 core/lib/Drupal/Core/Render/Element/MoreLink.php
  3. 11.x core/lib/Drupal/Core/Render/Element/MoreLink.php

Namespace

Drupal\Core\Render\Element

File

core/lib/Drupal/Core/Render/Element/MoreLink.php

View source
<?php

namespace Drupal\Core\Render\Element;


/**
 * Provides a link render element for a "more" link, like those used in blocks.
 *
 * Properties:
 * - #title: The text of the link to generate (defaults to 'More').
 *
 * See \Drupal\Core\Render\Element\Link for additional properties.
 *
 * Usage Example:
 * @code
 * $build['more'] = [
 *   '#type' => 'more_link',
 *   '#url' => Url::fromRoute('examples.more_examples')
 * ]
 * @endcode
 *
 * @RenderElement("more_link")
 */
class MoreLink extends Link {
    
    /**
     * {@inheritdoc}
     */
    public function getInfo() {
        $info = parent::getInfo();
        return [
            '#title' => $this->t('More'),
            '#theme_wrappers' => [
                'container' => [
                    '#attributes' => [
                        'class' => [
                            'more-link',
                        ],
                    ],
                ],
            ],
        ] + $info;
    }

}

Classes

Title Deprecated Summary
MoreLink Provides a link render element for a "more" link, like those used in blocks.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.