BBCode - Featured Card

License Latest Stable Version

A Flarum extension. A BBCode which creates a card in a post in order to feature a link/page/etc. BBCode: [featured url=][/featured]

Screenshot

Optional attributes include title= and theme=. By default with no theme name added the card will use your forum's colors. For the first release there is only one other theme to show the possibilities and it is called "rainbow" (i.e. theme=rainbow).

A full example with all parameters used:

[featured url=https://flarum.org title=Flarum theme=rainbow]Flarum is modern forum software which is minimal, light-weight, and fun to use. The community behind the software is vibrant and many developers contribute to the core code and extensions.[/featured]

Example with minimal (only required) attributes:

[featured url=https://flarum.org]Flarum is modern forum software which is minimal, light-weight, and fun to use. The community behind the software is vibrant and many developers contribute to the core code and extensions.[/featured]

Card is accessible ready. Many times these cards are not accessible due to the way they are coded. This is coded with the following in mind: https://inclusive-components.design/cards/

Installation

composer require zerosonesfun/flarum-featured-card

Updating

composer update zerosonesfun/flarum-featured-card

Removing

composer remove zerosonesfun/flarum-featured-card

Links

The "rainbow" theme:

🌈

    • [deleted]

    SUPER ULTRA COOL ! ! !

    14 days later

    shebaoting I think other languages will work now. Please update to version 1.0.2.

    Originally this used a built in method to force plain text only. That probably means plain Latin style text only. I’ve changed it so that hopefully other types of text will work.

    This extension is causing this error when enabled. Before the update it was working flawlessly.

     [2021-06-23 23:37:15] flarum.ERROR: RuntimeException: Token {SIMPLETEXT1} is ambiguous or undefined in /home/kobocity/flarum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/BBCodeMonkey.php:148
    Stack trace:
    #0 /home/kobocity/flarum/vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateModifier.php(152): s9e\TextFormatter\Plugins\BBCodes\Configurator\BBCodeMonkey->s9e\TextFormatter\Plugins\BBCodes\Configurator\{closure}(Array, Object(DOMText))
    #1 /home/kobocity/flarum/vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateModifier.php(55): s9e\TextFormatter\Configurator\Helpers\TemplateModifier::replaceTokensInText(Object(DOMText), '#\\{(?:[A-Z]+[A-...', Object(Closure))
    #2 /home/kobocity/flarum/vendor/s9e/text-formatter/src/Configurator/Items/Template.php(179): s9e\TextFormatter\Configurator\Helpers\TemplateModifier::replaceTokens('<section class=...', '#\\{(?:[A-Z]+[A-...', Object(Closure))
    #3 /home/kobocity/flarum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/BBCodeMonkey.php(153): s9e\TextFormatter\Configurator\Items\Template->replaceTokens('#\\{(?:[A-Z]+[A-...', Object(Closure))
    #4 /home/kobocity/flarum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator.php(104): s9e\TextFormatter\Plugins\BBCodes\Configurator\BBCodeMonkey->create('[featured url={...', Object(s9e\TextFormatter\Configurator\Items\Template))
    #5 /home/kobocity/flarum/vendor/zerosonesfun/flarum-featured-card/extend.php(28): s9e\TextFormatter\Plugins\BBCodes\Configurator->addCustom('[featured url={...', '<section class=...')
    #6 /home/kobocity/flarum/vendor/flarum/core/src/Formatter/Formatter.php(164): Flarum\Extension\Extension->Zerosonesfun\FeaturedCard\{closure}(Object(s9e\TextFormatter\Configurator))
    #7 /home/kobocity/flarum/vendor/flarum/core/src/Formatter/Formatter.php(196): Flarum\Formatter\Formatter->getConfigurator()
    #8 /home/kobocity/flarum/vendor/illuminate/cache/Repository.php(420): Flarum\Formatter\Formatter->Flarum\Formatter\{closure}()
    #9 /home/kobocity/flarum/vendor/flarum/core/src/Formatter/Formatter.php(197): Illuminate\Cache\Repository->rememberForever('flarum.formatte...', Object(Closure))
    #10 /home/kobocity/flarum/vendor/flarum/core/src/Formatter/Formatter.php(240): Flarum\Formatter\Formatter->getComponent('js')
    #11 /home/kobocity/flarum/vendor/flarum/core/src/Forum/ForumServiceProvider.php(112): Flarum\Formatter\Formatter->getJs()
    #12 [internal function]: Flarum\Forum\ForumServiceProvider->Flarum\Forum\{closure}()
    #13 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Compiler/Source/StringSource.php(38): call_user_func(Object(Closure))
    #14 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Compiler/Source/StringSource.php(49): Flarum\Frontend\Compiler\Source\StringSource->getContent()
    #15 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Compiler/RevisionCompiler.php(204): Flarum\Frontend\Compiler\Source\StringSource->getCacheDifferentiator()
    #16 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Compiler/RevisionCompiler.php(67): Flarum\Frontend\Compiler\RevisionCompiler->calculateRevision(Array)
    #17 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Compiler/RevisionCompiler.php(107): Flarum\Frontend\Compiler\RevisionCompiler->commit()
    #18 /home/kobocity/flarum/vendor/fof/nightmode/src/Content/Assets.php(119): Flarum\Frontend\Compiler\RevisionCompiler->getUrl()
    #19 [internal function]: FoF\NightMode\Content\Assets->FoF\NightMode\Content\{closure}(Object(Flarum\Frontend\Compiler\JsCompiler))
    #20 /home/kobocity/flarum/vendor/fof/nightmode/src/Content/Assets.php(118): array_map(Object(Closure), Array)
    #21 /home/kobocity/flarum/vendor/fof/nightmode/src/Content/Assets.php(55): FoF\NightMode\Content\Assets->getUrls(Array)
    #22 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Frontend.php(62): FoF\NightMode\Content\Assets->__invoke(Object(Flarum\Frontend\Document), Object(Laminas\Diactoros\ServerRequest))
    #23 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Frontend.php(54): Flarum\Frontend\Frontend->populate(Object(Flarum\Frontend\Document), Object(Laminas\Diactoros\ServerRequest))
    #24 /home/kobocity/flarum/vendor/flarum/core/src/Frontend/Controller.php(32): Flarum\Frontend\Frontend->document(Object(Laminas\Diactoros\ServerRequest))
    #25 /home/kobocity/flarum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Frontend\Controller->handle(Object(Laminas\Diactoros\ServerRequest))
    #26 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}(Object(Laminas\Diactoros\ServerRequest), Array)
    #27 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ExecuteRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
    #28 /home/kobocity/flarum/vendor/malago/flarum-achievements/src/Middlewares/MiddlewarePosted.php(27): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #29 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Malago\Achievements\Middlewares\MiddlewarePosted->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #30 /home/kobocity/flarum/vendor/fof/stopforumspam/src/Middleware/RegisterMiddleware.php(101): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #31 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): FoF\StopForumSpam\Middleware\RegisterMiddleware->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #32 /home/kobocity/flarum/vendor/fof/oauth/src/Middleware/ErrorHandler.php(50): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #33 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): FoF\OAuth\Middleware\ErrorHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #34 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ContentTypeOptionsHeader.php(21): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #35 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ContentTypeOptionsHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #36 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ReferrerPolicyHeader.php(30): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #37 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ReferrerPolicyHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #38 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/FlarumPromotionHeader.php(30): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #39 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\FlarumPromotionHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #40 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ShareErrorsFromSession.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #41 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ShareErrorsFromSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #42 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #43 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #44 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #45 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ResolveRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #46 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #47 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #48 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #49 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #50 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #51 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #52 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #53 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #54 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/CollectGarbage.php(46): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #55 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CollectGarbage->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #56 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #57 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #58 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #59 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #60 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #61 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\InjectActorReference->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #62 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #63 /home/kobocity/flarum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #64 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\RequestHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #65 /home/kobocity/flarum/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #66 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #67 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(42): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #68 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #69 /home/kobocity/flarum/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #70 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #71 /home/kobocity/flarum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #72 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ProcessIp->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
    #73 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
    #74 /home/kobocity/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(73): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
    #75 /home/kobocity/flarum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
    #76 /home/kobocity/flarum/vendor/flarum/core/src/Http/Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
    #77 /home/kobocity/flarum/public/index.php(26): Flarum\Http\Server->listen()
    #78 {main}  

      Ffuser1 Thanks for letting me know. This is fixed now. Please update to latest version.

      a year later

      010101 hello ,
      Is it possible to make the post view like this?
      I want the topics I opened to look like Featured Card

        newbb1 With enough CSS knowledge and time, yes. If you want the first post in each discussion to look different, target the data-index attribute like so:

        .PostStream-item[data-index="0"] {
        background-color: red;
        }

          010101 ![
          Is it possible to do the marked part? thanks for the answer.

            newbb1 Please start a new discussion with the support tag if you have further questions about customizing Flarum since this doesn’t have to do with this extension.

            But, yes, if you are asking if you can target sticky discussions in the main discussion list, you can.

            <div class="DiscussionListItem Slidable DiscussionListItem--sticky">

            That’s the classes in the div. So, you can target .DiscussionListItem--sticky.

            a year later