{"id":21890912,"url":"https://github.com/statikbe/craft-ctafield","last_synced_at":"2025-03-22T03:12:02.888Z","repository":{"id":57059234,"uuid":"142435640","full_name":"statikbe/craft-ctafield","owner":"statikbe","description":"Fieldtype that combines custom links, entries \u0026 classes","archived":false,"fork":false,"pushed_at":"2025-01-03T08:53:15.000Z","size":161,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-02-27T19:13:02.597Z","etag":null,"topics":["craft-plugin","craft3","craftcms"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statikbe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-26T12:06:44.000Z","updated_at":"2025-01-03T08:53:10.000Z","dependencies_parsed_at":"2025-01-26T21:36:42.490Z","dependency_job_id":"2e68eb34-e944-4054-afc1-a4d22f523575","html_url":"https://github.com/statikbe/craft-ctafield","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.03448275862068961,"last_synced_commit":"b4eec793386c315377d76fefc798f02db4bd882f"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-ctafield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-ctafield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-ctafield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-ctafield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statikbe","download_url":"https://codeload.github.com/statikbe/craft-ctafield/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898458,"owners_count":20528341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["craft-plugin","craft3","craftcms"],"created_at":"2024-11-28T12:18:16.289Z","updated_at":"2025-03-22T03:12:02.862Z","avatar_url":"https://github.com/statikbe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CTA field plugin for Craft\n\n## Requirements\n\nThis plugin requires Craft CMS 3.0.0 or later.\n\n\n## Migrating to [verbb/hyper](https://github.com/verbb/hyper)\nIn an effort to phase out the usage of this plugin, we've added 2 console commands to migration the fields and their content to [Hyper](https://github.com/verbb/hyper).\n\nThese are the steps you should follow:\n- Install hyper\u003cbr\u003e ``ddev composer require \"verbb/hyper\" -w \u0026\u0026 ddev exec php craft plugin/install hyper``\n- Install Config Values Field \u003cbr\u003e ``ddev composer require \"statikbe/craft-config-values\" -w \u0026\u0026 ddev exec php craft plugin/install config-values-field``\n- Resave and check your supertable tables (visit `/admin/super-table/settings` and click both buttons)\n\n\u003e [!Caution]  \n\u003e If supertable is missing tables/columns, or entire fields are marked as missing - please fix that first before proceeding.\n\n- Migrate field settings.\u003cbr\u003e ``ddev craft cta/migrate/statik-cta-field`` \u003cbr\u003e This will transform all your CTA fields to Hyper fields and update their project config files.\n- Migratie field content.\u003cbr\u003e ``ddev craft cta/migrate/statik-cta-content`` \u003cbr\u003e You'll have to run this on each environment, but only **after** you ran the fields command or you deployed the changes.\n\n\n## Installation\n\nTo install the plugin, follow these instructions.\n\n1. Open your terminal and go to your Craft project:\n\n        cd /path/to/project\n\n2. Then tell Composer to load the plugin:\n\n        composer require statikbe/craft-cta-field\n\n3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Link Field.\n\n## Templating\n\nLink fields on your models will return an instance of `cta\\models\\Link`. Rendering a link\nfield directly within a template will return the url the field is pointing to.\n\n```\n\u003ca href=\"{{ item.myLinkField }}\"\u003eLink\u003c/a\u003e\n```\n\nYou can use the following accessors to get the different properties of the link:\n\n```\n{{ item.myLinkField.getElement() }}\n{{ item.myLinkField.getTarget() }}\n{{ item.myLinkField.getText() }}\n{{ item.myLinkField.getUrl() }}\n{{ item.myLinkField.hasElement() }}\n{{ item.myLinkField.isEmpty() }}\n```\n\nUse the `getLink` utility function to render a full html link:\n\n```\n{{ item.myLinkField.getLink() }}\n```\n\nYou can pass the desired content of the link as a string, e.g.\n```\n{{ entry.linkField.getLink('Imprint') }}\n```\n\nYou may also pass an array of attributes. When doing this you can override\nthe default attributes `href` and `target`. The special attribute `text`\nwill be used as the link content.\n```\n{{ entry.linkField.getLink({\n  class: 'my-link-class',\n  target: '_blank',\n  text: 'Imprint',\n}) }}\n```\n\nTo get the CTA as a span (eg to use in clickable blocks), you can use the `getSpan()` function.\n```\n{{ entry.linkField.getSpan({\n  class: 'my-link-class',\n  text: 'Imprint',\n}) }}\n```\n\n## Configuration\n### Custom classes\nAdd custum classes to the dropdown menu.\n\n1. Add cta.php to /config\n2. Declare your classes:\n```\n\u003c?php\n\nreturn [\n    'classes' =\u003e [\n        'btn'                   =\u003e 'Primary',\n        'btn btn--secondary'    =\u003e 'Secondary'\n    ]\n];\n```\n\n### Linking between sites\nBy default, linking to entries from another site is not enabled. To make this work, you can use this config setting:\n\n```\n\u003c?php\n\nreturn [\n    'crossSiteLinking' =\u003e true\n];\n```\n\n## Credits\n\nHeavily inspired by [sebastian-lenz/craft-linkfield](https://github.com/sebastian-lenz/craft-linkfield/blob/master/README.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Fcraft-ctafield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatikbe%2Fcraft-ctafield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Fcraft-ctafield/lists"}