{"action":"created","issue":{"url":"https://api.github.com/repos/getkirby/panel/issues/433","labels_url":"https://api.github.com/repos/getkirby/panel/issues/433/labels{/name}","comments_url":"https://api.github.com/repos/getkirby/panel/issues/433/comments","events_url":"https://api.github.com/repos/getkirby/panel/issues/433/events","html_url":"https://github.com/getkirby/panel/pull/433","id":67913067,"number":433,"title":"Add possibility for blueprint snippets","user":{"login":"theWeird","id":165980,"avatar_url":"https://avatars.githubusercontent.com/u/165980?v=3","gravatar_id":"","url":"https://api.github.com/users/theWeird","html_url":"https://github.com/theWeird","followers_url":"https://api.github.com/users/theWeird/followers","following_url":"https://api.github.com/users/theWeird/following{/other_user}","gists_url":"https://api.github.com/users/theWeird/gists{/gist_id}","starred_url":"https://api.github.com/users/theWeird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theWeird/subscriptions","organizations_url":"https://api.github.com/users/theWeird/orgs","repos_url":"https://api.github.com/users/theWeird/repos","events_url":"https://api.github.com/users/theWeird/events{/privacy}","received_events_url":"https://api.github.com/users/theWeird/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-04-12T13:07:18Z","updated_at":"2015-10-23T13:14:31Z","closed_at":"2015-10-23T12:36:31Z","pull_request":{"url":"https://api.github.com/repos/getkirby/panel/pulls/433","html_url":"https://github.com/getkirby/panel/pull/433","diff_url":"https://github.com/getkirby/panel/pull/433.diff","patch_url":"https://github.com/getkirby/panel/pull/433.patch"},"body":"Imagine the following scenario:\r\n\r\nYou extracted a complex part of template code (e.g. a visual slider) to a template snippet like 'slider.php'. This snippet is ment to be used by many different templates.\r\n\r\nBut in order to configure the slider in the panel you have to add and maintain ALL fields for the slider in EVERY page blueprint that uses the slider in frontend.\r\n\r\n```\r\n# blueprints/home.php\r\nfields:\r\n  title:\r\n    label: Titel\r\n    type:  text\r\n  text:\r\n    label: Text\r\n    type:  textarea\r\n    size:  large\r\n  lbl_sliders:\r\n    label: Slider\r\n    type: headline\r\n  sliders:\r\n    label: Elemente\r\n    type: structure\r\n    entry: >\r\n      {{headline}}\r\n    fields: [...]\r\n```\r\n\r\nMy modification enables you to import a \"Blueprint Field Snippet\" into any other snippet.\r\n\r\nCreate a new folder site/blueprints/snippets and place a new blueprint inside:\r\n\r\n```\r\n# blueprints/snippets/slider.php\r\nfields:\r\n  lbl_sliders:\r\n    label: Slider\r\n    type: headline\r\n  sliders:\r\n    label: Elemente\r\n    type: structure\r\n    entry: >\r\n      {{headline}}\r\n    fields: [...]\r\n```\r\n\r\nAfterwards you can import the fields defined in this snippet into ANY other blueprint like this:\r\n\r\n```\r\n# blueprints/home.php\r\nfields: \r\n  title:\r\n    label: Titel\r\n    type:  text\r\n  text:\r\n    label: Text\r\n    type:  textarea\r\n    size:  large\r\n  im_slider:\r\n    type: snippet\r\n    file: slider\r\n```\r\n\r\nYou can also import multiple snippets at once by specifying the 'file' attribute as array:\r\n\r\n```\r\nfields:\r\n  imports: \r\n    type: snippet\r\n    file: \r\n      - file1\r\n      - file2\r\n```"},"comment":{"url":"https://api.github.com/repos/getkirby/panel/issues/comments/150567693","html_url":"https://github.com/getkirby/panel/pull/433#issuecomment-150567693","issue_url":"https://api.github.com/repos/getkirby/panel/issues/433","id":150567693,"user":{"login":"lukasbestle","id":1595007,"avatar_url":"https://avatars.githubusercontent.com/u/1595007?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasbestle","html_url":"https://github.com/lukasbestle","followers_url":"https://api.github.com/users/lukasbestle/followers","following_url":"https://api.github.com/users/lukasbestle/following{/other_user}","gists_url":"https://api.github.com/users/lukasbestle/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasbestle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasbestle/subscriptions","organizations_url":"https://api.github.com/users/lukasbestle/orgs","repos_url":"https://api.github.com/users/lukasbestle/repos","events_url":"https://api.github.com/users/lukasbestle/events{/privacy}","received_events_url":"https://api.github.com/users/lukasbestle/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T13:14:31Z","updated_at":"2015-10-23T13:14:31Z","body":"That's a very, very awesome solution. :+1: "}}