{"id":257,"date":"2020-04-22T06:24:32","date_gmt":"2020-04-22T06:24:32","guid":{"rendered":"https:\/\/localhost\/bricksacademy\/?post_type=bricks_article&p=257"},"modified":"2022-08-05T17:52:45","modified_gmt":"2022-08-05T17:52:45","slug":"link-control","status":"publish","type":"bricks_article","link":"https:\/\/academy.bricksbuilder.io\/article\/link-control\/","title":{"rendered":"Link Control"},"content":{"rendered":"\n
The link control give you the choice of different link types:<\/p>\n\n\n\n
class Prefix_Element_Link extends \\Bricks\\Element {\n \/\/ Set builder controls\n public function set_controls() {\n $this->controls['exampleLink'] = [\n 'tab' => 'content',\n 'label' => esc_html__( 'Link', 'bricks' ),\n 'type' => 'link',\n 'pasteStyles' => false,\n 'placeholder' => esc_html__( 'http:\/\/yoursite.com', 'bricks' ),\n \/\/ 'exclude' => [\n \/\/ 'rel',\n \/\/ 'newTab',\n \/\/ ],\n ];\n }\n\n \/\/ Render element HTML\n public function render() {\n if ( isset( $this->settings['exampleLink'] ) ) {\n \/\/ Set link attributes by passing attribute key and link settings\n $this->set_link_attributes( 'a', $this->settings['exampleLink'] );\n\n echo '<a ' . $this->render_attributes( 'a' ) . '>' . get_bloginfo( 'name' ) . '<\/a>';\n } else {\n esc_html_e( 'No link provided.', 'bricks' );\n }\n }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"The link control give you the choice of different link types: Internal post\/page External URL Popup (image, video)<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":155,"template":"","format":"standard","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/bricks_article\/257"}],"collection":[{"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/bricks_article"}],"about":[{"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/types\/bricks_article"}],"author":[{"embeddable":true,"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/bricks_article\/257\/revisions"}],"predecessor-version":[{"id":3014,"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/bricks_article\/257\/revisions\/3014"}],"wp:attachment":[{"href":"https:\/\/academy.bricksbuilder.io\/api\/wp\/v2\/media?parent=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}