Remove redundant blocks from posts
This commit is contained in:
parent
333217311d
commit
cf7d1f30de
|
@ -8,13 +8,10 @@ tags:
|
|||
- admin:hover
|
||||
- administration
|
||||
---
|
||||
{% block excerpt %}
|
||||
Sorry for the lack of Blog posts lately, but [my new job](http://horseandcountry.tv) that I started a few weeks ago has certainly been keeping me busy! I've got a few more posts that I'm preparing content for, and I'll hopefully be back into my weekly-post routine before too long!
|
||||
|
||||
Today, I'd like to just give a quick overview of the [Admin:hover](http://drupal.org/project/admin_hover) module. It basically adds an administrative menu that pops up when you hover over a node or block within your Drupal website - the kind of functionality that was present within previous versions of the [Admin module](http://drupal.org/project/admin). It also integrates well with the [Devel](http://drupal.org/project/devel) and [Clone](http://drupal.org/project/node_clone) modules.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
I've found this to be extremely useful whilst working on photo galleries etc. where multiple nodes are displayed in a grid format and I quickly need to publish or unpublish something for testing purposes. No longer do I need to open each node, or go into the administration area to perform the required actions.
|
||||
|
||||
It is also possible to customise which links are available from within the adminstration area. The possible selections that I currently have on this site are as follows:
|
||||
|
@ -41,4 +38,3 @@ It is also possible to customise which links are available from within the admin
|
|||
* Add block
|
||||
|
||||
Although, as I have additional contributed modules installed, some of these may not neccassaily be available out of the box.
|
||||
{% endblock %}
|
||||
|
|
|
@ -8,13 +8,10 @@ tags:
|
|||
- sql
|
||||
- sequel-pro
|
||||
---
|
||||
{% block excerpt %}
|
||||
At the end of my last post, I'd finished creating the first part of the new photo gallery, but I wanted to change the dates of the published photos to reflect the ones on the client's original website.
|
||||
|
||||
Firstly, I'll refer to the previous list of published galleries that I created before, and create something different that also displays the created and modified dates. Picking the node ID of the required gallery, I used the following SQL query to display a list of photos.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
```language-sql
|
||||
SELECT n.title, n.nid, n.created, n.changed, p.field_gallery_nid
|
||||
FROM node n, content_type_photo pWHERE n.type = 'photo'
|
||||
|
@ -41,4 +38,3 @@ Now when I query the database, both the created and modified dates have been up
|
|||
Once the changes have been applied, it's a case of repeating the above process for each of the required galleries.
|
||||
|
||||
In the next post, I'll explain how to add a count of published galleries and photos on the main photo gallery page, as well as how to install and configure the [Shadowbox](http://drupal.org/project/shadowbox) module.
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,13 +6,10 @@ tags:
|
|||
- drupal-planet
|
||||
- drupal
|
||||
---
|
||||
{% block excerpt %}
|
||||
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
|
||||
|
||||
I have previously seen it done this way by adding this into in a node.tpl.php file:
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
```language-php
|
||||
if ($teaser) {
|
||||
// The teaser output.
|
||||
|
@ -64,4 +61,3 @@ array (
|
|||
```
|
||||
|
||||
Now, within my theme I can create a new node--article-teaser.tpl.php template file and this will get called instead of the node--article.tpl.php when a teaser is loaded. As I'm not specifying the node type specifically and using the dynamic <em>$node->type</em> value within my suggestion, this will also apply for all other content types on my site and not just news articles.
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,13 +7,10 @@ tags:
|
|||
- theming
|
||||
- preprocessing
|
||||
---
|
||||
{% block excerpt %}
|
||||
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code. Following the example of the [Omega theme](http://drupal.org/project/omega "The Omega theme on Drupal.org"), I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
|
||||
|
||||
The first step is to use the default mytheme_process() and mytheme_preprocess() functions to utilise my custom function. So within my template.php file:
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
```language-php
|
||||
<?php
|
||||
|
||||
|
@ -82,4 +79,3 @@ function mytheme_invoke($type, $hook, &$variables) {
|
|||
```
|
||||
|
||||
As `mytheme_invoke()` checks to see if the function already exists before searching for checking the include files, I could still add the functions into template.php as normal and this would override any corresponding include file.
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,13 +4,10 @@ excerpt: <a href="http://www.sublimetext.com/2" title="Sublime Text 2">Sublime T
|
|||
tags:
|
||||
- sublime-text
|
||||
---
|
||||
{% block excerpt %}
|
||||
[Sublime Text 2](http://www.sublimetext.com/2) has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference.
|
||||
|
||||
These preferences ensure that the code is compliant with [Drupal coding standards](http://drupal.org/coding-standards "Drupal coding standards on Drupal.org") - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
## Preferences
|
||||
|
||||
These can be changed by going to Preferences > Settings - User.
|
||||
|
@ -99,4 +96,3 @@ These are the packages that I currently have installed.
|
|||
* [Package Control](http://wbond.net/sublime_packages/package_control)
|
||||
* [Sublime CodeIntel](http://github.com/Kronuz/SublimeCodeIntel)
|
||||
* [Theme - Soda](https://github.com/buymeasoda/soda-theme)
|
||||
{% endblock %}
|
||||
|
|
|
@ -8,11 +8,8 @@ tags:
|
|||
- drupal-planet
|
||||
- php
|
||||
---
|
||||
{% block excerpt %}
|
||||
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
```language-php
|
||||
global $user;
|
||||
if ($user->uid) {
|
||||
|
@ -57,4 +54,3 @@ function mymodule_menu() {
|
|||
```
|
||||
|
||||
There is also a [user_is_anonymous()](http://api.drupal.org/api/drupal/modules!user!user.module/function/user_is_anonymous/7) function if you want the opposite result. Both of these functions are available in Drupal 6 and higher.
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,12 +6,8 @@ tags:
|
|||
- precedent
|
||||
- personal
|
||||
---
|
||||
{% block excerpt %}
|
||||
Yesterday was my last day working at [Nomensa](http://www.nomensa.com "Nomensa"). Next week, I'll be starting as a Senior Developer at [Precedent](http://www.precedent.co.uk "Precedent").
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
The last 14 months that I've been working at Nomensa have been absolutely fantastic, and had allowed me to work on some great projects for great clients - mainly [unionlearn](http://www.unionlearn.org "unionlearn") and [Digital Theatre Plus](http://www.digitaltheatreplus.com "Digital Theatre Plus"). I've learned so much about accessibility and web standards, and have pretty much changed my whole approach to front-end development to accommodate best practices. I've also been involved with the Drupal Accessibility group since starting at Nomensa, and have written several accessibility-focused Drupal modules, including the [Nomensa Accessible Media Player](http://drupal.org/project/nomensa_amp "The Nomensa Accessible Media Player Drupal module") module and the [Accessibility Checklist](http://drupal.org/project/a11y_checklist "The accessibility checklist for Drupal"). I'll definitely be continuing my interest in accessibility, championing best practices, and incorporating it into my future work wherever possible.
|
||||
|
||||
With that all said, I'm really looking forward to starting my new role at Precedent, tackling some new challenges, and I'm sure that it'll be as great a place to work as Nomensa was.
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,11 +7,8 @@ tags:
|
|||
- git
|
||||
- terminal
|
||||
---
|
||||
{% block excerpt %}
|
||||
Whilst watching [Drupalize.me](http://drupalize.me "Drupalize.me")'s recent [Introduction to Git series](http://drupalize.me/series/introduction-git-series "Introduction to Git on Drupalize.me"), I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Here's how to do it.
|
||||
|
||||
For example (with some slight modifications):
|
||||
|
@ -63,4 +60,3 @@ PS1="\u@\h:\w\$(parse_git_branch_or_tag) $ "
|
|||
```
|
||||
|
||||
Restart your Terminal or type `source ~/.bashrc` to see your changes.
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,11 +4,8 @@ excerpt: Here are the basic commands that you need to adminster a virtual machin
|
|||
tags:
|
||||
- vagrant
|
||||
---
|
||||
{% block excerpt %}
|
||||
[Vagrant](http://www.vagrantup.com "About Vagrant") is a tool for managing virtual machines within [VirtualBox](https://www.virtualbox.org) from the command line. Here are some useful commands to know when using Vagrant.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Command | Description
|
||||
:-|:-
|
||||
vagrant init {box} | Initialise a new VM in the current working directory. Specify a box name, or "base" will be used by default.
|
||||
|
@ -21,4 +18,3 @@ vagrant halt (-f) | Halt the Vagrant box. Use -f to forcefully shut down the box
|
|||
vagrant destroy (-f) | Destroys a Vagrant box. Use -f to forcefully shut down the box without prompting for confirmation.
|
||||
|
||||
The full Vagrant documentation can be found at <http://docs.vagrantup.com/v2/>.
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,13 +5,10 @@ tags:
|
|||
- git
|
||||
- drupal-planet
|
||||
---
|
||||
{% block excerpt %}
|
||||
Testing a patch file is usually a two-step process. First you download the patch file from the source, and then you run a separate command to apply it.
|
||||
|
||||
You can save time and typing by running the two commands on one line:
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
```language-bash
|
||||
$ curl http://drupal.org/files/[patch-name].patch | git apply -v
|
||||
```
|
||||
|
@ -25,4 +22,3 @@ $ wget -q -O - http://drupal.org/files/[patch-name].patch | git apply -v
|
|||
These commands need to be run within the root of your Git repository (i.e. where the .git directory is).
|
||||
|
||||
These snippets were taken from [Applying Patches with Git](https://drupal.org/node/1399218) on Drupal.org.
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,13 +6,10 @@ tags:
|
|||
- drupal-planet
|
||||
- drush
|
||||
---
|
||||
{% block excerpt %}
|
||||
If you use [Drush](https://raw.github.com/drush-ops/drush/master/README.md "About Drush"), it's likely that you've used the `drush pm-download` (or `drush dl` for short) command to start a new project. This command downloads projects from Drupal.org, but if you don't specify a project or type "drush dl drupal", the command will download the current stable version of Drupal core. Currently, this will be Drupal 7 with that being the current stable version of core at the time of writing this post.
|
||||
|
||||
But what if you don't want Drupal 7?
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
I still maintain a number of Drupal 6 sites and occassionally need to download Drupal 6 core as opposed to Drupal 7. I'm also experimenting with Drupal 8 so I need to download that as well.
|
||||
|
||||
By declarding the core version of Drupal, such as "drupal-6", Drush will download that instead.
|
||||
|
@ -44,4 +41,3 @@ $ drush dl drupal-8
|
|||
```
|
||||
|
||||
For a full list of the available options, type "drush help pm-download" into a Terminal window or take a look at the entry on [drush.ws](http://drush.ws/#pm-download, "The entry for pm-download on drush.ws").
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,11 +7,8 @@ tags:
|
|||
- fonts
|
||||
- sass
|
||||
---
|
||||
{% block excerpt %}
|
||||
How to use an @each loop in SASS to quickly include multiple font files within your stylesheet.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Using a file structure similar to this, organise your font files into directories, using the the font name for both the directory name and for the file names.
|
||||
|
||||
```language-bash
|
||||
|
@ -60,4 +57,3 @@ When the CSS has been compiled, you can then use in your CSS in the standard way
|
|||
```language-scss
|
||||
font-family: "FuturaBook";
|
||||
```
|
||||
{% endblock %}
|
||||
|
|
|
@ -11,13 +11,10 @@ meta:
|
|||
excerpt: 'How to define a minimum Drupal core version for your module or theme.'
|
||||
type: article
|
||||
---
|
||||
{% block excerpt %}
|
||||
This week, my first code patch was [committed to Drupal core](https://www.drupal.org/node/2394517#comment-9773143). The patch adds the `user_has_role()` function to the user module, to simplify the way to check whether a user in Drupal has been assigned a specific role. This is something that I normally write a custom function for each project, but it's now available in Drupal core as of [7.36](https://www.drupal.org/drupal-7.36-release-notes).
|
||||
|
||||
But what if someone is using a core version less than 7.36 and tries using the function? The site would return an error because that function wouldn't exist.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
If you're building a new Drupal site, then I'd assume that you're using a latest version of core, or you have the opportunity to update it when needed. But what if you're writing a contrib module? How can you be sure that the correct minimum version of core?
|
||||
|
||||
## Setting Dependencies
|
||||
|
@ -71,4 +68,3 @@ Because we need to check for Drupal's core version, we're using the system modul
|
|||
## External Links
|
||||
|
||||
* [Writing module .info files (Drupal 7.x)](https://www.drupal.org/node/542202#dependencies)
|
||||
{% endblock %}
|
||||
|
|
|
@ -8,11 +8,8 @@ tags:
|
|||
- vuejs
|
||||
has_tweets: true
|
||||
---
|
||||
{% block excerpt %}
|
||||
Earlier this week, I built a clone of [Drupal][0]’s default theme, Bartik, with [Vue.js][1] and [Tailwind CSS][2]. You can [view the code on GitHub][3] and the [site itself on Netlify][4].
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'tweet' with {
|
||||
content: '<p lang="en" dir="ltr">I built a clone of Bartik, <a href="https://twitter.com/hashtag/Drupal?src=hash&ref_src=twsrc%5Etfw">#Drupal</a>'s default theme, with <a href="https://twitter.com/vuejs?ref_src=twsrc%5Etfw">@vuejs</a> and <a href="https://twitter.com/tailwindcss?ref_src=twsrc%5Etfw">@tailwindcss</a>. See the result at <a href="https://t.co/nPsTt2cawL">https://t.co/nPsTt2cawL</a>, and the code at <a href="https://t.co/Dn8eysV4gf">https://t.co/Dn8eysV4gf</a>.<br><br>Blog post coming soon... <a href="https://t.co/7BgqjmkCX0">pic.twitter.com/7BgqjmkCX0</a></p>— Oliver Davies (@opdavies) <a href="https://twitter.com/opdavies/status/1064906717392191488?ref_src=twsrc%5Etfw">November 20, 2018</a>',
|
||||
data_cards: true,
|
||||
|
@ -294,7 +291,6 @@ The whole task only took around two hours to complete, and although some of the
|
|||
<div class="note" markdown="1">
|
||||
I’ve also made some additional changes since this version, which are described in [this follow-up post](/blog/rebuilding-bartik-with-vuejs-tailwind-css-part-2).
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
[0]: https://www.drupal.org
|
||||
[1]: https://vuejs.org
|
||||
|
|
|
@ -8,11 +8,8 @@ tags:
|
|||
- vuejs
|
||||
has_tweets: true
|
||||
---
|
||||
{% block excerpt %}
|
||||
In [the original post](/blog/rebuilding-bartik-with-vuejs-tailwind-css) I detailed how I built [a clone of Drupal’s Bartik theme][netlify] with [Vue.js][vuejs] and [Tailwind CSS][tailwind]. This follow-up post details some updates that I’ve made to it since then.
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
## Customising Tailwind’s colours
|
||||
|
||||
During the first version of the page, my thoughts were to not edit the Tailwind configuration, however I changed my mind on this whilst working on the subsequent updates and did make some changes and customisations to the `tailwind.js` file.
|
||||
|
@ -240,7 +237,6 @@ new Vue({
|
|||
{.border}
|
||||
|
||||
__The updated version is [live on Netlify][netlify], and the [latest source code is available on GitHub][github].__
|
||||
{% endblock %}
|
||||
|
||||
[github]: https://github.com/opdavies/rebuilding-bartik
|
||||
[netlify]: https://rebuilding-bartik.netlify.com
|
||||
|
|
|
@ -8,9 +8,6 @@ tags:
|
|||
- vuejs
|
||||
draft: true
|
||||
---
|
||||
{% block excerpt %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
- https://rebuilding-acquia.netlify.com
|
||||
- https://github.com/opdavies/rebuilding-acquia
|
||||
|
||||
|
@ -34,4 +31,3 @@ draft: true
|
|||
<img src="/images/blog/rebuilding-acquia-vue-tailwind/3-environment.png" alt="" class="border border-grey-light p-2">
|
||||
<figcaption>The rebuilt page for an environment within an application.</figcaption>
|
||||
</figure>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue