Is there a way to limit where a block displays based on a query in the URL?
Solutions
You can implement a condition plugin that does just that and then configure your block to use that condition, we did something similar once:
/**
* Condition on the page query param.
*
* @Condition(
* id = "yourproject__first_page",
* label = @Translation("First page (by url query param)")
* )
*/
class FirstPage extends ConditionPluginBase {
/**
* {@inheritdoc}
*/
public function evaluate() {
$match = !\Drupal::request()->query->get('page');
return $this->configuration['negate'] ? !$match : $match;
}
/**
* {@inheritdoc}
*/
public function summary() {
return $this->t($this->configuration['negate'] ? 'The %param parameter is not %value' : 'The %param parameter is %value or empty', ['%param' => 'page', '%value' => 0]);
}
}
changing my ip based url to name based url
basically i have my website under 91.xx.xx.76/mywebsite in folder /var/www/mywebsite and i want the user to type www.mywebsite.com, i have search some methods in doing so but doesn't actually solve it. they say to create a file under sites-available then enabled it i have created file under sites-available and also enabled it using a2ensite mywebsi...
How to programmatically create a View on a node that displays SQL Query content?
How can I programmtically create a View on node(s) that displays the content from a specific query? For example I would like to display the following: Essentially, I would like to grab the 'nid' from the current node and I would like the View to display all 'users' associated with the current node, as the query would return. I have been able to ach...
How to limit access to content for which the Content Access module doesn't limit access?
I run a small business, and have created a website in Drupal 8 (should have used 7, bit late now, oooops). Part of the website is designed to be behind a subscription, which I've got working and works well. Only problem is, the content types I want to only be visible to people who have paid, are visible to everyone. I installed the Content Access m...