Drupal https://planet.communia.org/en/taxonomy/term/78 en Caches de drupal https://planet.communia.org/ca/content/caches-de-drupal <span class="field-wrapper p-name">Caches de drupal</span> <span class="field-wrapper"><a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="https://planet.communia.org/sites/default/files/pictures/aleixwar2.jpg" alt="kinta" /> </a> <a title="View user profile." href="/en/users/kinta" lang="" about="/en/users/kinta" typeof="schema:Person" property="schema:name" datatype="">kinta</a></span> <span class="field-wrapper">Thu, 06/07/2018 - 12:04</span> <div class="field-wrapper body field e-content field-node--body field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item"><p>Caches de drupal</p> </div> </div> </div> <div class="field-wrapper text-content field field-node--field-link field-name-field-link field-type-link field-label-above"> <div class="field-label">Link</div> <div class="field-items"> <div class="field-item"><a href="https://www.dx-experts.nl/blog/2017/drupal-8-development-caching">https://www.dx-experts.nl/blog/2017/drupal-8-development-caching</a></div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-above"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/ca/etiquetes/develop" hreflang="ca">develop</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> <div class="field-item"><a href="/ca/etiquetes/cache" hreflang="ca">cache</a></div> </div> </div> <section class="field-wrapper"> <h2 class="field-items">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=6407&amp;2=comment&amp;3=comment" token="7TWLPdUnE5WJ9cRsR9BXb54iS2-o49wgVFIn1_DDqeA"></drupal-render-placeholder> </section> Thu, 07 Jun 2018 10:04:16 +0000 kinta 6407 at https://planet.communia.org https://planet.communia.org/ca/content/caches-de-drupal#comments https://tecnonucleous.com/2018/06/05/mas-de-115000-sitios-drupal-aun-vulnerables-al-exploit-drupalgeddon2/ https://planet.communia.org/ca/content/httpstecnonucleouscom20180605mas-de-115000-sitios-drupal-aun-vulnerables-al-exploit <span class="field-wrapper p-name">https://tecnonucleous.com/2018/06/05/mas-de-115000-sitios-drupal-aun-vulnerables-al-exploit-drupalgeddon2/</span> <span class="field-wrapper"><a href="/user/5" class="visually-hidden p-author h-card" rel="author" title="mmxals">mmxals <img src="" alt="mmxals" /> </a> <a title="View user profile." href="/en/users/mmxals" lang="" about="/en/users/mmxals" typeof="schema:Person" property="schema:name" datatype="">mmxals</a></span> <span class="field-wrapper">Tue, 06/05/2018 - 17:32</span> <div class="field-wrapper text-content field field-node--field-link field-name-field-link field-type-link field-label-above"> <div class="field-label">Link</div> <div class="field-items"> <div class="field-item"><a href="https://tecnonucleous.com/2018/06/05/mas-de-115000-sitios-drupal-aun-vulnerables-al-exploit-drupalgeddon2/">https://tecnonucleous.com/2018/06/05/mas-de-115000-sitios-drupal-aun-vulnerable…</a></div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-above"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/ca/etiquetes/drupalgeddon2" hreflang="ca">Drupalgeddon2</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> <div class="field-item"><a href="/ca/etiquetes/seguretat" hreflang="ca">Seguretat</a></div> </div> </div> <section class="field-wrapper"> <h2 class="field-items">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=6406&amp;2=comment&amp;3=comment" token="qjR9aG1VDb68mtGq5ezh26wE_Zx3ccg2k10s7ku-zh4"></drupal-render-placeholder> </section> Tue, 05 Jun 2018 15:32:40 +0000 mmxals 6406 at https://planet.communia.org https://planet.communia.org/ca/content/httpstecnonucleouscom20180605mas-de-115000-sitios-drupal-aun-vulnerables-al-exploit#comments Managing multiple drupals (7 and 8, composer and drush) https://planet.communia.org/ca/content/managing-multiple-drupals-7-and-8-composer-and-drush <span class="field-wrapper p-name">Managing multiple drupals (7 and 8, composer and drush)</span> <span class="field-wrapper"><a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="https://planet.communia.org/sites/default/files/pictures/aleixwar2.jpg" alt="kinta" /> </a> <a title="View user profile." href="/en/users/kinta" lang="" about="/en/users/kinta" typeof="schema:Person" property="schema:name" datatype="">kinta</a></span> <span class="field-wrapper">Tue, 04/03/2018 - 18:38</span> <div class="field-wrapper body field e-content field-node--body field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item"><p><span><span><span>Most drupal projects that we have created at communia require maintenance, and when the number of projects to mantain grow, a strategy is needed to carry out mass actions such as modules or libraries installation, upgrades, cleaning of caches or registries to monitor.</span></span></span></p> <p><span><span>Until version 8, drush allowed to create alias and group them together to perform operations by group. For example, an @autoup group could be created that allowed updating the drupals that were known to have had no reason at all to give bugs in the update.</span></span></p> <p><span><span>All this has come under review with Drupal 8, at the time that drupal goes on to follow the open innovation strategy that allows the inclusion of code not specifically designed for drupal, also known as innovation strategy <em><a href="https://www.drupal.org/8/standards">Proudly Found Elsewhere</a></em> (such as symfony, easyrdf, doctrine, twig ...).The orchestration of all the dependencies is done via <span><a href="https://getcomposer.org/doc/00-intro.md">composer</a></span> , and specifically from drupal 8 it is recommended to install a <span><a href="https://github.com/drupal-composer/drupal-project">structure (scaffolding)</a></span> .</span></span></p> <p><span><span>This gives us these changes in the structure of the project:</span></span></p> <p><img alt="Drupal7 structure vs Drupal 8 structure(drupal-composer scaffolding)" data-entity-type="file" data-entity-uuid="7b5d1084-238d-4ffb-ab1a-74644ef87b48" src="/sites/default/files/inline-images/drupal7-vs-drupalcomposer_1.png" /></p> <p><span><span>Where you really manage the dependencies is at web's parent directory, it is in the root folder of drupal-project where we will run composer to install dependencies.</span></span></p> <p><span><span>All these changes imply a new perspective to manage the project, we can no longer rely on drush, and in fact the version of drush 9.x <span><a href="https://drushcommands.com/drush-9x/pm/pm:download/">already warns us</a></span> that installing modules for drush is abandoned.</span></span></p> <p><span><span>Since I have not found a tool to manage multiple composer projects, I have created the <span><a href="https://github.com/aleixq/druman">druman</a></span> console <span><a href="https://github.com/aleixq/druman">application</a></span> with the symfony <span><a href="https://symfony.com/doc/current/console.html">console command</a></span> component .So you can do a project management based on drush, or composer.</span></span></p> <p><span><span><span><strong>Druman project manager at drupal</strong></span></span></span></p> <p><span><span>This program is based on a list defined in yml that will be ~ / .druman-aliases.yml, where we define some properties for each project: alias, path, groups, manager.</span></span></p> <p><span><span>There is an example of a yml in the examples folder:</span></span></p> <ul><li> <p><span><span><strong>alias</strong>: it will be the name with which we will index and we will be able to access the project.</span></span></p> </li> <li> <p><span><span><strong>Path</strong>: this is the path of the project, if we use the structure drupal-composer we must give the root of the project (not that of the web). If we do not use the drupal-composer structure we have to put the web root. If we want a remote alias we have to write "" there.</span></span></p> </li> <li> <p><span><span><strong>Groups</strong>: list of groups to which the project belongs, for example autoup if we want to do a group of self-updating or hacked if we want to list projects in which we have to pay special attention when updating or installing modules. (you can put the names that you want, those that have been put in the example are examples).</span></span></p> </li> <li> <p><span><span><strong>Manager</strong>: Which manager we will use to control dependencies:</span></span></p> <ul><li> <p><span><span><strong>drush8</strong> It will be useful for the command projects:update (useless in command projects:run), it uses the drush (v8) manager to update it following the standard drupal 7 procedure (not recommended by drupal 8).</span></span></p> </li> <li> <p><span><span><strong>drupal-composer</strong> It will be useful for the command projects:update (useless in command projects:run), it uses the composer manager to proceed with the update in drupal-composer structures.</span></span></p> </li> <li> <p><span><span><strong>drush8-alias</strong> It will be useful when updating project process (with the projects:update command) and when drush commands are called (via command projects:run).Indicate the drush8-alias manager is the way to keep a remote (or local) site defined in the drush aliases, instead of reinventing the logic of remote drush alias, I have chosen to reuse it. Aliases will be treated without changing to the project directory (since the path is not defined) or by changing the user, it is done just like drush aliases (with possible subsequent permissions problems that may arise). When calling, drush @alias will always be added, so the drush and druman alias must match, and the drush command should only be said, for example:</span></span><br />  </p> <pre> <code class="language-bash">druman project: run -a project_x status</code></pre></li> </ul></li> </ul><p><span><span><span><strong>Remote project management (only drupal 7).</strong></span></span></span></p> <p><span><span>We have to pay special attention to the fact that if we use a drush8-alias manager in a project to manage remote projects, we must first define the remote alias as always with drush until version 8. This is so by not having to rewrite the logic that drush uses to connect to remote (To add an alias to drush there is information at: <span><a href="https://raw.githubusercontent.com/drush-ops/drush/8.x/examples/example.aliases.drushrc.php">https://raw.githubusercontent.com/drush-ops/drush/8. x / examples / example.aliases.drushrc.php</a></span> ).Thus, the alias must be defined in ~ / .drush / aliases.drushrc.php and ~ / .druman-aliases.yml, maybe in the future this changes to be able to launch remotely composers.</span></span></p> <p><span><span>If we define a project managed by <strong>drush8-alias</strong> the path must be blank</span></span></p> <pre> <code class="language-yaml">alias: someexternal_com path: "" groups: hostingatx manager: drush8-alias</code></pre><p><span><span><span><strong>List projects</strong></span></span></span></p> <p><span><span>To dump the <strong>list of projects</strong> we can use:</span></span></p> <pre> <code class="language-bash">druman projects:list</code></pre><p><span> </span></p> <p><span><span>In order to <strong>filter</strong> the list by group or by origin (local or remote), this command allows the following options:</span></span></p> <pre> <code class="language-bash">druman projects: list -h Usage: projects: list [options] Options: -g, --group [= GROUP] List only projects of specified group -l, --local List only local projects -r, --remote List only remote projects -f, --full Show all fields from list: alias, path, management type and group.</code></pre><p><span> </span></p> <p><span><span><span><strong>Running commands at the root of projects</strong></span></span></span></p> <p><span><span>From the list of projects defined in .druman-aliases.yml we can perform operations. We can throw an order at the root of the project with:</span></span></p> <pre> <code class="language-bash">projects:run</code></pre><p><span><span>We will have the same filtering options as when we list and additionally the option of selecting a single aliases directly. The options are:</span></span></p> <pre> <code class="language-bash">druman projects:run -h Usage: projects: run [options] [-] [&lt;order&gt;] Arguments: order Command to run. Options: -g, --group [= GROUP] Run only on these projects which are members of specified group -a, --alias [= ALIAS] Run only on this specific alias -l, --local List only local projects -r, --remote List only remote projects -all, --all Run in all alias, except those using drush8-alias manager, if specified no filters will be used </code></pre><p><span><span>Before executing the command it will <strong>change the user</strong> by who is the owner of the folder defined in the path of the alias.</span></span></p> <p><span><span><span><strong>Running project updates</strong></span></span></span></p> <p><span><span>To update, there is the command druman projects:update, which allows the same options as the projects:run command.</span></span></p> <pre> <code class="language-bash">projects:update -h -g, --group [= GROUP] Run only on these projects which are members of specified group -a, --alias [= ALIAS] Run only on this specific alias -l, --local List only local projects -r, --remote List only remote projects -all, --all Run in all alias, excluding those using drush8-alias manager</code></pre><p><span><span>The way you update the projects managed by <strong>drush8-alias</strong> or <strong>drush8</strong> follow the orders to update a <strong>drupal 7</strong> .The way you update the projects managed by <strong>drupal-composer</strong> follow the procedure to update a <strong>drupal 8</strong> .You can see the procedures at <span><a href="https://github.com/aleixq/druman/blob/master/src/Command/ManagerRunnerProjectsCommand.php">https://github.com/aleixq/druman/blob/master/src/Command/ManagerRunnerProjectsCommand.php</a></span> .</span></span></p> <p><span><span><span><strong>What's left:</strong></span></span></span></p> <ul><li> <p><span><span>Remote, be able to manage remote drupal with composer. Maybe the way would be to add ssh properties to .druman-aliases.yml. Or, as with those indicated by a drush8-alias manager, define a remote alias as explained in <span><a href="https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.site.yml">https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.site.yml</a></span> .</span></span></p> </li> <li> <p><span><span>also add, remove or update projects from .druman-aliases.yml interactively.</span></span></p> </li> </ul><p><span> </span></p> </div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-inline clearfix"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> <div class="field-item"><a href="/ca/etiquetes/tutorials" hreflang="ca">tutorials</a></div> <div class="field-item"><a href="/ca/etiquetes/documentacio" hreflang="ca">documentació</a></div> <div class="field-item"><a href="/ca/etiquetes/composer" hreflang="ca">composer</a></div> <div class="field-item"><a href="/ca/etiquetes/php" hreflang="ca">php</a></div> <div class="field-item"><a href="/ca/etiquetes/drush" hreflang="ca">drush</a></div> </div> </div> Tue, 03 Apr 2018 16:38:23 +0000 kinta 6396 at https://planet.communia.org Linkback module tagged alpha https://planet.communia.org/content/linkback-module-tagged-alpha <span class="field-wrapper p-name">Linkback module tagged alpha</span> <div class="field-wrapper image field field-node--field-image field-name-field-image field-type-image field-label-hidden"> <div class="field-items"> <div class="field-item"> <a href="/sites/default/files/webmention-logo-380_0_0.png"> <img srcset="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0_0.png?itok=WRUx7Pve 325w, /sites/default/files/styles/max_650x650/public/webmention-logo-380_0_0.png?itok=wJueH0N0 380w" sizes="(min-width: 1290px) 325px, (min-width: 851px) 25vw, (min-width: 560px) 50vw, 100vw" src="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0_0.png?itok=WRUx7Pve" alt="" typeof="foaf:Image" /> </a> </div> </div> </div> <span class="field-wrapper"><a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="https://planet.communia.org/sites/default/files/pictures/aleixwar2.jpg" alt="kinta" /> </a> <a title="View user profile." href="/en/users/kinta" lang="" about="/en/users/kinta" typeof="schema:Person" property="schema:name" datatype="">kinta</a></span> <span class="field-wrapper">Mon, 12/04/2017 - 15:48</span> <div class="field-wrapper body field e-content field-node--body field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item"><p>The <a href="https://www.drupal.org/project/linkback">Linkback module</a>(<a href="https://planet.communia.org/content/manual-de-linkback-drupal-8">background information</a>) for Drupal 8 has been tagged alpha today!  here a good intro about it written by <a href="http://hongpong.com/">HongPong</a>. We've done a lot of work to get there!</p> <blockquote> <p>Note for alpha1 release:</p> <p>We are proud to bring you the first alpha release of <strong>Linkback</strong>, an interesting suite of modules which can help integrate your website with the wider internet. Linkback provides the backend functionality to save both outgoing and incoming pings and webmentions involving remote sites.</p> <p>This first release focuses on a robust, spam resistant and fault tolerant approach to processing and storing Linkbacks as Drupal entities, which provides a standardized and efficient storage structure that can be easily queried and extended. (Anyone interested in improving the theming is invited to file an issue or share code with us :) More information about the functions in the Linkback suite is in Developer.md and the Readme.md files inside each child module.</p> <p>linkback_pingback creates the appropriate endpoints on your site to receive pingbacks from other sites (that is, someone on a WordPress site includes a link to your site and attempts to send a pingback; linkback_pingback receives the ping, scans the originating site URL to see if it a really existing anchor there, and if so, then it saves a new Linkback with the pingback handler attached to it.</p> <p>linkback_webmention provides much the same functionality for your site to send and receive Webmentions. (see other <a href="https://webmention.net/implementations/" rel="nofollow">Webmention implementations</a> - this module should interoperate with them). Services such as <a href="https://brid.gy/" rel="nofollow">brid.gy</a> can help connect proprietary content silos like Facebook and Twitter to your webmentions.</p> <p>Linkback has been cleverly structured to apply the best of Drupal 8 and Symfony architecture while reapplying many of the ideas from its predecessor <a href="https://drupal.org/project/vinculum" rel="nofollow">Vinculum</a> which provided similar services in Drupal 7. It should be feasible to extend Linkback to store other similar types of entities as records of intra-site communication.</p> <p>Thank you for trying Linkback - it is a product of several years of effort including bringing "<a href="https://indieweb.org/" rel="nofollow">indieweb</a>" principles and specifications into Drupal.</p> </blockquote></div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-inline clearfix"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/en/etiquetes/sil-hostil" hreflang="en">sil-hostil</a></div> <div class="field-item"><a href="/ca/etiquetes/webmentions" hreflang="ca">webmentions</a></div> <div class="field-item"><a href="/ca/etiquetes/linkback" hreflang="ca">linkback</a></div> <div class="field-item"><a href="/ca/etiquetes/semantica" hreflang="ca">semantica</a></div> <div class="field-item"><a href="/ca/etiquetes/rdf" hreflang="ca">rdf</a></div> <div class="field-item"><a href="/ca/etiquetes/microformats2" hreflang="ca">microformats2</a></div> <div class="field-item"><a href="/en/etiquetes/pingbacks" hreflang="en">pingbacks</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal-8" hreflang="ca">Drupal 8</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> </div> </div> Mon, 04 Dec 2017 14:48:52 +0000 kinta 6374 at https://planet.communia.org Manual de Linkback per drupal 8 https://planet.communia.org/content/manual-de-linkback-drupal-8 <span class="field-wrapper p-name">Manual de Linkback per drupal 8</span> <div class="field-wrapper image field field-node--field-image field-name-field-image field-type-image field-label-hidden"> <div class="field-items"> <div class="field-item"> <a href="/sites/default/files/webmention-logo-380_0.png"> <img srcset="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0.png?itok=qBkStNvE 325w, /sites/default/files/styles/max_650x650/public/webmention-logo-380_0.png?itok=SU0ngvBJ 380w" sizes="(min-width: 1290px) 325px, (min-width: 851px) 25vw, (min-width: 560px) 50vw, 100vw" src="/sites/default/files/styles/max_325x325/public/webmention-logo-380_0.png?itok=qBkStNvE" alt="" title="webmentions" typeof="foaf:Image" /> </a> </div> </div> </div> <span class="field-wrapper"><a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="https://planet.communia.org/sites/default/files/pictures/aleixwar2.jpg" alt="kinta" /> </a> <a title="View user profile." href="/en/users/kinta" lang="" about="/en/users/kinta" typeof="schema:Person" property="schema:name" datatype="">kinta</a></span> <span class="field-wrapper">Tue, 05/02/2017 - 00:33</span> <div class="field-wrapper body field e-content field-node--body field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item"><p><strong>¡¡Aquesta entrada té un contingut amb llenguatge tècnic, sobre com instal·lar i desenvolupar un blog federable-federat dins la blogosfera</strong>!!</p> <h2>Instal·lació i configuració</h2> <p>Avís: el mòdul <a href="https://www.drupal.org/project/linkback">linkback</a> està en desenvolupament, i tot i que hi ha una versió en dev, que sigui en dev significa que to el que explico a continuació és susceptible a canvis.</p> <p>Descarrega el módul de linkbacks i activa linkback_pingback i linkback webmention. El mòdul linkback s'activarà com a dependència. Com que té dependències d'algunes llibreries via composer, s'haurà de modificar el composer.json de l'arrel, això s'haurà de fer cada cop que s'actualitzi el core:</p> <ul><li> <p>Activar el repo de github per la lib de microformats/test , dependència de mf2:</p> <ul><li> <pre> composer config repositories.1 vcs https://github.com/microformats/tests</pre></li> </ul></li> <li> <p>Activar la llibreria de mf2:</p> <ul><li> <pre> composer require mf2/mf2:dev-master</pre></li> </ul></li> <li> <p>Activar el client de webmention :</p> <ul><li> <pre> composer require indieweb/mention-client:dev-master</pre></li> </ul></li> <li> <p>Afegim el camp linkbacks al tipus de contingut que vulguem (de moment només es pot associar a entitats de tipus node [contingut]). Amb això ja tindrem la base.</p> </li> <li> <p>Hi han poques coses a configurar: si vols processar els linkbacks rebuts o enviats via cron o manualment, per llocs en producció més val confiar en el cron. Arribats a aquest punt quan rebem pingbacks/webmentions la nostra web ho porcessarà.</p> </li> <li> <p>Tot i això podem treure més suc de les relacions de web a web i dotar d'una semàntica bàsica el nostre site, podem triar microformats2 o rdf. Tot i que amb RDF podrem construir descripcions més acurades, com a punt de partida i tenint en compte que volem tenir un blog pel segle XXI amb microformats ja en tindrem prou. En una propera entrada de blog ja especificaré com es podria fer per dotar de descriptors rdf el nostre site i adaptar el mòdul linkbacks per tal que processi rdf's més complexes.</p> </li> </ul><h2>Oferta microformats2</h2> <p>Pel que fa al processament de microformats2 el mòdul linkbacks ja té tot el que ha de tenir, fa servir la <a href="https://packagist.org/packages/mf2/mf2">llibreria mf2</a>. El que no tindrem preparat és l'oferta de microformats al nostre lloc web. Per fer-ho haurem de modificar una mica el tema que haguem escollit pel nostre drupal. En el nostre cas fem servir un subtema de <a href="http://foundation.zurb.com/">foundation 6</a>, però es pot aplicar al que vulguem. Hi han dos entitats que necessiten ser modificades:</p> <ul><li> <p>El tipus de contingut que fem servir per crear entrades de blog. Normalment article o blog_entry.</p> </li> <li> <p>L'usuari. Això es configura al directori themes/nomdeltema/nomdeltema.theme i s'afegeixen les plantilles pertinents al directori themes/nomdeltema/templates/.</p> </li> </ul><h3>Theming del tipus de contingut</h3> <p>Hi han algunes aplicacions globals: e-content pel que fa a body i p-name pel que fa a títols. Així doncs en tots els camps on s'utilitzi aquests camps afegirem la classe corresponent. Al fitxer nomdeltema.theme:</p> <pre> /** * Implements template_preprocess_field(). */ function planet_founding_preprocess_field(&amp;$variables) { $element = $variables['element']; switch($element['#field_name']){ case 'body': $apply_mf = "e-content"; break; case 'title': $apply_mf = "p-name"; break; } if (!empty($apply_mf)){ $variables['attributes']['class'][] = $apply_mf; $variables['items'][0]['content']['#options']['attributes']['class'][] = $apply_mf; } }</pre><p>Un cop fet això podem modificar les plantilles per tal que s'afegeixin algunes classes i per adaptar l'estructura del DOM. A node.html.twig:</p> <pre> /** * El tag de html 'article' es descriu com a: h-entry. * * @todo Remove the id attribute (or make it a class), because if that gets * rendered twice on a page this is invalid CSS for example: two lists * in different view modes. * * @ingroup themeable */ #} {# !MF2 Afegim la descripció de h-entry a l'etiquta article #} &lt;article id="node-{{ node.id }}" {{ attributes.addClass('h-entry') }} &gt; {# !MF2 Afegim el link a la url del node amb text buit i la propietat u-url #} &lt;a class="u-url" href="{{ url }}"&gt;&lt;/a&gt; {{ title_prefix }} {% if teaser %} {# !MF2 En cas de teaser afegir la propietat p-name al títol#} &lt;h1{{ title_attributes.addClass('teaser').addClass('p-name') }}&gt; &lt;a href="{{ url }}" rel="bookmark"&gt;{{ label }}&lt;/a&gt; &lt;/h1&gt; {% elseif not page %} &lt;h2{{ title_attributes }}&gt; {# !MF2 En cas que no sigui teaser i tampoc pàgina completa afegir la propietat p-name al títol #} &lt;a href="{{ url }}" rel="bookmark" class="p-name" &gt;{{ label }}&lt;/a&gt; &lt;/h2&gt; {% elseif page %} {# !MF2 En cas que sigui pàgina completa afegir la propietat p-name al títol #} &lt;span class="hidden p-name"&gt;{{ label }}&lt;/span&gt; {% endif %} {{ title_suffix }} {% if display_submitted %} &lt;small&gt; &lt;p&gt; &lt;div class="posted row"&gt; &lt;div class="columns shrink align-self-middle"&gt; &lt;div class="float-left"&gt; {{ author_picture }} &lt;/div&gt; &lt;div{{ author_attributes.addClass('float-left').addClass('submitted') }}&gt; {# !MF2 Afegim la propietat de data del post dt-published #} {% trans %}Submitted by {{ author_name }} on &lt;time class="dt-published"&gt;{{ date }}&lt;/time&gt;{% endtrans %} {{ metadata }} &lt;/div&gt; {% if content.field_tags|length &gt; 2 and not is_front %} &lt;div class="tags fi-pricetag-multiple"&gt; {{ content.field_tags }} &lt;/div&gt; {% endif %} &lt;/div&gt; &lt;/div&gt; &lt;/p&gt; &lt;/small&gt; {% endif %} {# We hide the comments and links now so that we can render them later. #} &lt;div{{ content_attributes }}&gt; {# En cas que fem servir un tipus de comentari diferent per cada tipus de contingut , Amaguem els comentaris associats al tipus de contingut per poder-lo mostrar després #} {{ content|without('comment','comment_node_blog', 'links', 'field_tags') }} &lt;/div&gt; {{ content.links }} {{ content.comment }} &lt;/article&gt; &lt;hr class="superspace"&gt; </pre><h3>Theming de l'usuari</h3> <p>Pel que fa a l'usuari s'ha d'afegir microformats a l'username insertat a dins el tipus de contingut(modificant la plantilla username), i també a la pròpia pàgina de l'usuari(full). A la pàgina pròpia de l'usuari també afegirem la variable view_mode per tal de poder treure etiquetes només en cas que es mostri l'usuari amb el display 'full'.</p> <p>Haurem d'afegir les propietats de l'usuari:</p> <p>- url</p> <p>- nom d'usuari</p> <p>- thumbnail</p> <p>Amb una estructura(especificada a <a href="http://microformats.org/wiki/microformats-2">http://microformats.org/wiki/microformats-2</a>) similar a: <a href="http://microformats.org/wiki/microformats-2">http://microformats.org/wiki/microformats-2</a> :</p> <pre> &lt;a class="h-card" href="http://url_de_l_usuari"&gt; &lt;img alt="nom de l'autor" src="urldelaimatge.jpg" /&gt; &lt;/a&gt;</pre><p>Pel que fa a <b>thumbnail</b> afegirem la variable userthumb als dos llocs per disposar de la url a la imatge de l'avatar sencera, tant des del node com des de l'usuari. A nomdeltema.theme:</p> <pre> /** * Implements template_preprocess_username(). */ function planet_founding_preprocess_username(&amp;$variables){ if (!$variables['account']-&gt;user_picture-&gt;isEmpty()) { $fid = $variables['account']-&gt;user_picture-&gt;first()-&gt;target_id; $file = \Drupal\file\Entity\File::load($fid); $variables['user_thumb'] = file_create_url($file-&gt;getFileUri()); } } /** * Implements template_preprocess_user * * Add template suggestions and classes */ function planet_founding_preprocess_user(&amp;$variables) { if (!$variables['user']-&gt;user_picture-&gt;isEmpty()) { $variables['user_thumb'] = file_create_url($variables['user']-&gt;user_picture-&gt;entity-&gt;getFileUri()); } $variables['view_mode'] = $variables['elements']['#view_mode']; }</pre><p>Pel que fa a l'estructura del <b>dom username</b> dins cada entrada de blog es mostrarà amb la plantilla username.html.twig:</p> <pre> {# /** * @file * Theme override for displaying a username. * * Available variables: * - account: The full account information for the user. * - name: The user's name, sanitized. * - extra: Additional text to append to the user's name, sanitized. * - link_path: The path or URL of the user's profile page, home page, * or other desired page to link to for more information about the user. * - link_options: Options to set on the \Drupal\Core\Url object if linking the * user's name to the user's page. * - attributes: HTML attributes for the containing element. * * @see template_preprocess_username() * - user_thumb: the thumbnail */ #} {% if link_path -%} &lt;a href="/{{ link_path }}" class="visually-hidden p-author h-card" rel="author" title="{{ name }}"&gt;{{ name }} &lt;img src="{{ user_thumb }}" alt="{{ name }}" /&gt; &lt;/a&gt; &lt;a{{ attributes }}&gt;{{ name }}{{ extra }}&lt;/a&gt; {%- else -%} &lt;span{{ attributes }}&gt;{{ name }}{{ extra }}&lt;/span&gt; {%- endif -%} </pre><p>Pel que fa al display de <b>l'usuari sencer</b> modificarem la plantilla user.html.twig afegirem una estructura similar a:</p> <pre> + * + * - view_mode: the rendered view mode string. */ #} -&lt;article{{ attributes }}&gt; +&lt;article{{ attributes.addClass('h-card') }}&gt; +{% if view_mode == "full" %} + &lt;a class="visually-hidden p-name u-url" href="user/{{ user.uid.value }}" rel="me" title=&gt;{{ user.name.value }}&lt;/a&gt; + &lt;img class="hidden u-photo" src="{{ user_thumb }}" /&gt; +{% endif %}</pre><p>  </p> <h3>Dotar de semàntica els links que afegim al cos de l'entrada de blog</h3> <p>Per tal de poder afegir semàntica als links que afegim via l'editor de text enriquit podem instal·lar el mòdul <a href="https://www.drupal.org/sandbox/kinta/2865999">editorsemanticlink</a> que ens permetrà dotar de semàntica a cada link a que afegim via l'editor ckeditor. (Configurar correctament a admin/config/content/formats/manage/basichtml o admin/config/content/formats/manage/fullhtml afegint atributs class i rel a l'etiqueta a) Amb això ja podrem afegir links semàntics al cos de text de les entrades de blog.</p> <h2>Consum de linkbacks</h2> <p>Cada cop que rebem un linkback s’anirà al lloc d’origen i s’intentarà fer un parsing de la metainformació del lloc que ens menciona, si té microformats2 o RDF crearà un array json que s’emmagatzemarà al camp metainfo del linkback. Si volem utilitzar aquesta metainformació (per exemple per fer llistats de linkbacks filtrables o agrupables), hauriem de mapejar camps del json a camps del linkback.</p> <p>Per fer-ho haurem d’anar a admin/structure/linkback/manage i afegir els camps que vulguem. El mapejarem anant a l’edició del field, i al camp de text afegirem la proietat de l’array json: per exemple si creem el camp autor, al mapeig hi posarem «author/name» per agafar la propietat:</p> <pre> { «autor» : {«name» : «alison»}, «url»: «http://myurl» }</pre><p>Si es vol agafar la propietat url, simplement es posa «url»</p> <p>Cada cop que es guardi processarà el mapeig i assignarà el valor.</p> <p>Pel mapeig hi ha més informació a: <a href="https://www.drupal.org/docs/8/modules/linkback/metainfo-mappinghttps://www.drupal.org/docs/8/modules/linkback/metainfo-mappinghttps://www.drupal.org/docs/8/modules/linkback/metainfo-mapping">https://www.drupal.org/docs/8/modules/linkback/metainfo-mapping</a></p> <h3>Mostrar linkbacks</h3> <p>Un cop fet això ja podrem rebre i enviar linkbacks semàntics i quedarà mostrar a cada entrada de blog un comptador i el llistat de comentaris.</p> <p>Per tenir-ho podem utilitzar <a href="https://www.drupal.org/sandbox/kinta/2873693">el módul Linkback semantic</a>. Que crea el camp semantic_type a l’entitat linkback i instal·la un bloc.</p> <p>Aquest es pot configurar perquè només es mostri als tipus de contingut que ens interessi i farà que quan rebem linkbacks i aquests siguin categoritzables semànticament, es pugui veure un comptador per tipus i un llistat de comentaris agrupats per tipus.</p> <p>També disposa d'una plantilla per tal de poder fer el theming corresponent. Si no convenç la llista de comentaris, es pot fer amb views.</p> </div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-inline clearfix"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/en/etiquetes/sil-hostil" hreflang="en">sil-hostil</a></div> <div class="field-item"><a href="/ca/etiquetes/webmentions" hreflang="ca">webmentions</a></div> <div class="field-item"><a href="/ca/etiquetes/linkback" hreflang="ca">linkback</a></div> <div class="field-item"><a href="/ca/etiquetes/semantica" hreflang="ca">semantica</a></div> <div class="field-item"><a href="/ca/etiquetes/rdf" hreflang="ca">rdf</a></div> <div class="field-item"><a href="/ca/etiquetes/microformats2" hreflang="ca">microformats2</a></div> <div class="field-item"><a href="/en/etiquetes/pingbacks" hreflang="en">pingbacks</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal-8" hreflang="ca">Drupal 8</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> </div> </div> Mon, 01 May 2017 22:33:32 +0000 kinta 126 at https://planet.communia.org Módulo gnusocial para drupal8 https://planet.communia.org/content/modulo-gnusocial-para-drupal8 <span class="field-wrapper p-name">Módulo gnusocial para drupal8 </span> <div class="field-wrapper image field field-node--field-image field-name-field-image field-type-image field-label-hidden"> <div class="field-items"> <div class="field-item"> <a href="/sites/default/files/gnusocial-drupal_0.png"> <img srcset="/sites/default/files/styles/max_325x325/public/gnusocial-drupal_0.png?itok=XGc1VuAo 325w, /sites/default/files/styles/max_650x650/public/gnusocial-drupal_0.png?itok=rrdTtP9i 649w, /sites/default/files/styles/max_1300x1300/public/gnusocial-drupal_0.png?itok=cgIvH2fo 800w" sizes="(min-width: 1290px) 325px, (min-width: 851px) 25vw, (min-width: 560px) 50vw, 100vw" src="/sites/default/files/styles/max_325x325/public/gnusocial-drupal_0.png?itok=XGc1VuAo" alt="" typeof="foaf:Image" /> </a> </div> </div> </div> <span class="field-wrapper"><a href="/user/1" class="visually-hidden p-author h-card" rel="author" title="kinta">kinta <img src="https://planet.communia.org/sites/default/files/pictures/aleixwar2.jpg" alt="kinta" /> </a> <a title="View user profile." href="/en/users/kinta" lang="" about="/en/users/kinta" typeof="schema:Person" property="schema:name" datatype="">kinta</a></span> <span class="field-wrapper">Fri, 06/03/2016 - 10:05</span> <div class="field-wrapper body field e-content field-node--body field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item"><p>(English <a href="http://cgit.drupalcode.org/sandbox-kinta-2732077/tree/README.txt?h=8.x-1.x">README</a>).</p> <p>El módulo gnusocial  habilita los comentarios de gnusocial a cualquier tipo de contenido de Drupal 8. Depende únicamente del módulo <a href="https://bojanz.wordpress.com/2015/09/18/d8-composer-definitive-intro/">composer manager</a>  para solucionar las dependencias del plugin de guzzle <a href="https://github.com/guzzle/oauth-subscriber">oauth-subscriber</a>.</p> <p>Puedes usar este módulo para postear un status cuando nuevo contenido es publicado en drupal, o simplemente para añadir cualquier conversación  que viva en una instancia gnusocial que implementa la api de statusnet.</p> <p>Basándome en el plugin de <a href="https://wordpress.org/plugins/wp-gnusocial/">wpgnusocial</a> y su idea de fondo: permitir comentarios de una red federada de conversaciones. </p> <p>Esto se consigue teniendo una cuenta del site en gnusocial (léase communiabot por ejemplo), esta será la que publicará la "notice" en gnusocial cuando un blog post se publique.</p> <p>Hay algunos cambios respeto a wpgnusocial:</p> <ul><li>El<strong> método de autentificación </strong>entre gnusocial y drupal se hace via Oauth 3-legged. Eso requiere crear previamente una aplicación en tu nodo de gnusocial. Ganamos evitar ir pasando contraseñas de un sitio a otro, y permitimos revocación de la conexión por parte de gnusocial.</li> <li>Posibilidad de <strong>asociar manualmente cualquier conversación </strong>de cualquier instancia gnusocial (configurada en el drupal o no) a un blog post generado, o editarla posteriormente.</li> <li>Se <strong>asocia a</strong> un elemento de la api de statusnet <strong>conversation</strong> (as in <a href="https://git.gnu.io/gnu/gnu-social/blob/master/actions/apiconversation.php">https://git.gnu.io/gnu/gnu-social/blob/master/actions/apiconversation.p…</a> | <a href="https://github.com/andstatus/andstatus/issues/328">https://github.com/andstatus/andstatus/issues/328</a> ).</li> <li><em>Está previsto (no implementado aún) de que si la publicación de comentarios sea en dos sentidos, o sea permitir comentarios en el site y  que la cuenta de gnu social asociada al site publique respuestas-comentarios.</em></li> <li><em>En un futuro se podrá configurar la visualización de la conversación de dos formas, obteniendo el hilo en</em><em> el lado del servidor via php, (tal como está desarrollado actualmente), o e</em><em>n el lado cliente(pendiente), para evitar trabajos en el servidor.</em></li> <li>Theming de la lista de comentarios y de cada status vía plantillas <a href="http://twig.sensiolabs.org/">twig</a>.</li> </ul><p>Intenta seguir en todo lo que puede las <a href="https://www.drupal.org/coding-standards">recomendaciones de drupal</a>, usando las librerías que usa drupal (<a href="http://docs.guzzlephp.org/en/latest/psr7.html">Guzzle</a>, <a href="http://symfony.com/">symfony</a>...), y usa la <a href="https://api.drupal.org/api/drupal/core%21modules%21field%21field.module/group/field/8.2.x">field api</a> de drupal para insertar los comentarios en las <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/group/entity_api/8.2.x">entidades</a>, con toda la flexibilidad que permite esto.</p> <h3>Pasos para configurarlo</h3> <p>(copiado del <a href="http://cgit.drupalcode.org/sandbox-kinta-2732077/tree/README.txt?h=8.x-1.x">README.txt</a> en inglés) :</p> <pre> If you want to simply attach the conversation --------------------------------------------- You'll have to add the field to the content you want in field configuration check "Gnusocial Comments" and uncheck "Post to GnuSocial". For every post you'll have to manually fill the field with the conversation json url. It's your job to get it. To get full functionality (attach comments and post to gnusocial): ------------------------------------------------------------------ You'll need to configure both in gnusocial and drupal. For Gnusocial part create the user that will act as bot. It will create the statuses anouncing your blog entries, allowing to create a conversation over. Go to: Settings &gt;connections; There click on register an Oauth client applic- ation in right sidebar (https://gnusocialurl/settings/oauthapps). You'll have to register a new application, so fill the fields: - Icon if you want it, - Name: a descriptive name of the app, for example drupal_gnusocial. - Description: Explain this application, for example: Communicates with a drupal site. - Source Url: The drupal url. - Organization: Optionally, the name of the organization that owns the drupal with gnusocial integration. - Homepage: The homepage of the organization . - Callback url: http://yourdrupal/admin/config/services/gnusocial. - Type of application: Browser. - Read-write After that a "Consumer key" and "Consumer secret" will be provided. Copy these in a text editor. Don't close the gnusocial tab (session) yet. We'll go to your drupal instance, there configure in: configuration &gt; services &gt; gnusocial. It will do a 3-legged authentication against the provided gnusocial url, so add the base url of gnusocial ( https://yourgnusocial.url.com ), OAuth consumer key, the "Consumer secret" and click save. After saving, click "update tokens", it will redirect to gnusocial url to complete the authentication, allowing the application to interact with gnusocial, after that it will redirect to drupal and the process will be completed. Developer info: --------------- You can use templates to theme the comments: - field: You can use the field template as gnusocial comments is a field. - gnusocial-conversation.html.twig will be the container of each conversation (between field wrapper and each status). It has the statuses list, the more link, and the conversation link. - gnusocial-status.html.twig will be the template used to render each status. </pre></div> </div> </div> <div class="field-wrapper field field-node--field-tags field-name-field-tags field-type-entity-reference field-label-inline clearfix"> <div class="field-label">Tags</div> <div class="field-items"> <div class="field-item"><a href="/ca/etiquetes/gnusocial" hreflang="ca">Gnusocial</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal" hreflang="ca">Drupal</a></div> <div class="field-item"><a href="/ca/etiquetes/drupal-8" hreflang="ca">Drupal 8</a></div> </div> </div> Fri, 03 Jun 2016 08:05:33 +0000 kinta 113 at https://planet.communia.org