texts: Why are there so many settings.php files one in each folder or sub-directory?

texts:
I am Drupal newbie taking over a poorly documented D6 group of sites organized by sub-domains. In examining the dev.[domain].org/sites/ folder I discover folders: all, default, demo.[domain].org and [customer].[domain].org and each folder has its own settings.php?

For example, /default/settings.php allows me to configure-or-edit the 'site_name' => and $db_url and $base_url. The $db_url works.

while, /all/settings.php has a disabled # $base_url and a disabled # 'site_name' => yet an active $db_url that is connecting to a 'mysql://[detail]' that may or may not be an active db.

I presume folders demo.[domain].org and [customer].[domain].org in the /sites/ folder are just legacy folders left by the previous coder/hacker of the settings.php used in the those sub-domains.

Your thoughts and answers will be gratefully consumed.

Thank you, Steve


texts: Resolving: Fatal error: Class 'CommerceGuys\Addressing\AddressFormat\AddressFormatRepository'

texts:
The Address module was installed using the Ludwig module. I tried to update the module, but I cannot, as the site gives me this error and the site install has not been done via Composer.
Everything was working fine until an unrelated module was installed.
The error message I get is the following.

Fatal error: Class 'CommerceGuys\Addressing\AddressFormat\AddressFormatRepository' not found in \modules\contrib\address\src\Repository\AddressFormatRepository.php on line 16

Most information I found involves using Composer to resolve the issue, but the site is not using Composer.
UPDATE: If anyone stumbles across this, I resolved the issue by Composerising the website. I followed this guide, then updated all modules, including Address, using Composer. I previously thought I wouldn't be able to composerise the website due to the error but I was wrong. Hopefully that helps someone.


texts: Why is the rate widget (from the Rate module) not showing up?

texts:
I'm using the Rate module, together with the entity reference module.

I have a content type let's name it "Gallery". I also created a "Photo" content type, then added a "yes/no" rate widget  to this content type. (c)

In "Gallery" I have an entity reference to "Photo".

Now I'm going to make a View like this: Show all of "Photo"s related to this "Gallery" plus rate widget related to every "Photo".

I created a view with nid as argument to get specific node, and two relation, first one is "Entity Reference: Referenced Entity", and second one is "Vote result". then I added first relation as a relation to second relation.

I added "Vote results:value" as field. So far I see the "Photos", but I couldn't get the rate widgets.

What am I missing to also get the rate widgets to show up?


texts: Caption box on my slideshow jumps when you refresh cache

texts:
When you access my site for the first time, the caption box on the slideshow starts lower by about 50px then adjusts itself to the correct position. Pressing Ctrl-F5 also recreates the problem.

Is there a way I can set a breakpoint within the CSS or Drupal so I can step through to find whats causing the problem? Also, any clues whats causing the problem?

thanks

website: www.terrafirmasouth.co.uk


texts:
I have to create a breadcrumb so that, if a page has a menu, the breadcrumb should be the menu with its hierarchy. If the node page doesn't have a menu, the page title should be in the breadcrumb.

I tries the Menu breadcrumb module. Menu pages are coming correctly, but other pages are showing the page title in the breadcrumb.

How can I achieve this?


texts:
In a custom module I'm trying to display results from mysql DB based on items users selected in a form. One of the fields in the content type I'd like to display is an image associated with the node. This image appears to be housed in the table 'file_managed' in a field called 'filename' - or at least that's where the NAME of the file is located. I'm able to retrieve that field fine using SQL and joins and when I echo the result it shows the following (for example):

nameoffile.png

So I tried calling that with php using:

$icon = $row['filename'];
echo $icon; // works fine

$output .= '<img src="' . $icon . '" />';

And it just shows a blank image icon (not the image nameoffile.png).

So then I think well I must have the path wrong. So I dragged the image icon from the search results page (where it displays just fine) into a new tab and this is the URL I get:

http://pf.dev/sites/default/files/styles/thumbnail/public/PPP_CCYCL_CLP_ChrevonCycle_A_8Red.png

But of course I don't want to use an absolute path, esp. since this is on the dev. server.

So my question is this: how do I find the paths to my content type images so I can display them correctly in my custom module?


texts: table styles not applied by bootstrap sub-theme

texts:
I'm writing a custom sub-theme of bootstrap with Drupal 9, and have noticed that table elements in my forums do not render properly:

This is despite me selecting "Bordered Table" in the configuration settings:

The next thing I tried was using Chrome's "inspect" feature to manually add class = "table" to the table element, which caused it render much more nicely;

I don't see any options to apply that class to table elements, either in the forum settings nor in the bootstrap settings.
I have a few questions to help me (and hopefully others) understand what's happening here;

Is adding the class = "table" to table elements the right approach?
Assuming it is, what's the right way to apply this class to table elements? (I've not averse to writing php code, I've just never written a theme before so I don't know where to start)
What's the point of those bootstrap table settings - they don't seem to do anything?

EDIT:
As per leymannx's suggestion, I've enabled twig debugging and looked at the resulting html:

      Forum
      Topics
      Posts
      Last post

            No new posts

General discussion

          0

        0

  n/a


texts: Updating Drush to newer version on Drupalpro VM Virtual Machine Instance

texts: I'm setting up a new vm box with a fresh copy of Drupalpro and I need to update Drush and I'm not sure how to go about it. Any ideas would be great. The current drush version that is preinstalled is 5.3 drush.


texts: Update install profile- with or without drush

texts:
I'm fairly new to drupal and I'm getting used to drush. I'm trying to update my site with drush up and it seems to update core, contrib modules and the database okay. However, I have several modules that came with my install profile that don't appear to be updating.

Do I have to update the install profile manually (upload the files myself) or is there some other way to update an install profile?

Thank you!


texts: Migrate files with directories and sub directories

texts:
I am having issues with migrating my files locally on my computer. Im using the migrate UI and my source_dir = /Users/cwahlfeldt/Sites/dev.urbanaillinois.us/sites/default/files/ which is a full path to the files I'm trying to migrate. destination_dir = public://. Im getting the following errors when attempting a migration:

Informational   Undefined property: stdClass::$value File /Users/cwahlfeldt/Sites/drupal-7.x-dev/sites/all/modules/migrate/plugins/destinations/file.inc, line 704(file: /Users/cwahlfeldt/Sites/drupal-7.x-dev/sites/all/modules/migrate/plugins/destinations/file.inc, line 704)

Error   The specified file /Users/cwahlfeldt/Sites/dev.urbanaillinois.us/sites/default/files/ could not be copied to public://files: "copy(): The first argument to copy() function cannot be a directory File /Users/cwahlfeldt/Sites/drupal-7.x-dev/sites/all/modules/migrate/plugins/destinations/file.inc, line 393"

The sources files directory has many sub directories within it and the copy() function thats used by the migrate module doesn't seem to want to take a directory. Is there a solution to this? Or is this caused by something else.


texts: subfolder installation user block login and destination issue

texts:
I have installed drupal 6.22(fresh installation) on my localhost in which i have set user block on header. Now my problem is when i looked to action of user login form, here i can see my folder name is there.

Say My url : http://localhost/drupal6/

So i can find my form action : /drupal6/node/85?destination=node%2F85

Now after login my url becomes http://localhost/drupal6//drupal6/node/85?destination=node%2F85 and I got page not found error.

And that actually creates issue on redirection.

I want to mention that i have installed 6.22 cause we need to make changes to older version. TIA. What could be the actual reason? Do I need to create a custom user login block for the same? or any issue in url function though i have not changed core files or not added any custom login module. My active theme is garland.

Edit:

Without login go to "http://localhost/drupal6/admin/settings/site-information", It shows access denied message then login using your account and you will face page not found error.

Cause in browser its showing me "http://localhost/drupal6//drupal6/admin/settings/site-information?destination=admin%2Fsettings%2Fsite-information".

Just try out in your any setup on localhost or on subdomain installation. Its not working as expected.

After login url should be "http://localhost/drupal6/admin/settings/site-information?destination=admin%2Fsettings%2Fsite-information" instead page not found. TIA

EDIT : MOD-Rewrite


texts: I was installing drupal commons on xampp server i got this error, PHP Max Execution Time 30 Your PHP execution time is too low, please set it greater than or equal to 120 seconds. How do i adjust the php execution time so that i can proceed with the installation?


texts: What part of the Feeds api knows if there is a difference between old and new data?

texts:
i want to flag an item if the feed has made any changes in a record.  What hook can I use to do a check of the new data and the old data to see if there is a difference?
I need to mark data that is changed with a flag and also get a log of all changed nodes.  Right now feeds seems to mark everything as updated even if there is no change.

I tried looking in hook_feeds_presave, but both the $item and the $entity are already changed there.  What hook can see a comparison between the old and the new ?


texts: How to use t() function for a text with anchor links?

texts:
I have a text that I must show in 5 languages. I am using t() for that. The text is:

  In case of any issues, please Contact Us for assistance.

I want the phrase "Contact Us" to be a link. So this is what I have done:

$text = t('In case of any issues, please ')."".t('Contact Us')."".t('for assistance');

I suspect that this might not be the correct way to do this as this will break the translation. I fear that the sentence will not be translated as a whole but in parts.

Am I right?

And if I am, what could be the correct way to do it?


texts:
I am trying to make a rule which when acted upon will send an email with custom details based on the rule arguments.

I made my rule event and that's all working fine it shows up, but when I add an action to "Send mail" and then look at all of the Replacement patterns non of my tokens show up, only site-information tokens show up.

Token Functions

/**
 * Implementation of hook_token_list()
 */
function mahjong_token_list($type = 'all') {
  if ($type == 'all' || $type == 'mahjong') {
    $tokens['mahjong'] = array(
      'package_name' => t('The name of the package'),
    );
  }

  return $tokens;
}

/**
 * Implementation of hook token api
 */
function mahjong_token_values($type, $object = NULL, $options = array()) {
  $tokens = array();
  var_dump($object);
  if ($object) {
    if ($type == 'mahjong') {
      $tokens = array(
        'user_name' => $object->name,
        'user_email' => $object->email,
        'user_score' => $object->score,
      );
    }
  }

  return $tokens;
}

Rules Function

function mahjong_rules_event_info() {
  return array(
    'mahjong_won' => array(
      'label' => t('A person won the mahjong game.'),
      'module' => 'mahjong',
      'group' => 'Rules',
      'arguments' => array(
        'user' => array('type' => 'mahjong', 'label' => t('The user who won the mahjong game.')),
      ),
    ),
  );
}

What am I doing wrong? How can I get the data from the rules argument pass to the action to send an email?


texts:
I have a view and used Better Exposed Filter module to show this Checkbox to filter the content in the view. The picture may explain the situation properly

In above filter by criteria, those values are Taxonomy Terms, which will increase later.

However my problem is, I want to have a Checkbox only for Development Taxonomy. So, instead of Filter by and list of Taxonomies, it would only be Filter by Development with a checkbox near to it. When the checkbox is checked it'd show the view which is Listed Under only Development

I tried something like CSS or jQuery show only this taxonomy class and hide other taxonomy terms, but that's last resort.

Any Drupal way I can accomplish this without writing codes?


texts: I have created a new content type with an Image field, and I've set it to save in private directory. In my configuration > File System, I have specified /sites/default/files/private as my private directory. File is saving to private directory as well. But when I open that private Image having url structure like /system/files/ in another browser. It shows up, It should not have shown in other browser. How can I make it private?


texts: Product Variation as Thumbnail rather than Dropdown

texts:
I am wondering if someone has tackled having product variations as thumbnails rather than a dropdown option.

Have a look at this page: http://www.partytimerentals.com/catalog/product/basic-poly-rounds

You see that I have loads of variations for that particular table linen, but my end user has to look through a load of item options. I need a way to show them the associated swatch, and when they click load that variation. The same as now, just as I said, an image thumbnail rather than a select box.

Any direction on this would be greatly appreciated. Thanks.

Here is a mockup of what I am looking for: http://cloud.um-me.com/0f1a2p1b1T0A

Aaron


texts:
First of all I want to let you know that I am a newbie with Drupal so maybe this question isn't good or even not possible to apply with Drupal.

I got a custom content type that includes in it a lot of fields and among them there are a date field and a list field.

My goal is that a pop window will flow when user enters my site, then he will submit a date and a value that the list contains, and he will get into a page that will display the nodes that include the same input he puts in.

Can someone explain me how to do it?

Thanks in advance :)


texts: Recover from a Lost Drupal Administration Menu

texts:
When I log into the Admin on my site, the drupal controls are all missing.  Our former Web Developers refered me to an article online that told me I need to enable the toolbars by:

What you need to do is access the main "Modules" page. The best way to get there is by typing in the URL of the modules page.

Try adding one of these to your main domain name:
•/admin/modules/
•?q=admin/modules

Neither of these worked. With /admin/modules/ I get "Page Not Found".

With ?q=admin/modules I get "Access Denied"

How can I get the drupal controls back so I can make edits?


texts: How do I generate PDF of HTML in a custom module?

texts:
I want to generate PDF in my custom module. Using print module we can print node. But I have made html in my custom module and that I wanted to make pdf and save it in files.

I have tried custom dompfg library but its working.
i wanted to do something like this:

$html = "
Header

Pdf generated.
";

include ("mpdf.php"); /// This will be something to include for mpdf
$mpdf=new mPDF('win-1252','A4','','',20,15,48,25,10,10);
$mpdf->WriteHTML($html);
$mpdf->Output('../default/files/users/filename.pdf','F');
exit;

Any suggestions?


texts: Is ist possible to get the page variables in node templates?

texts:
I set a variable by implementing the hook hook_preprocess_page. The variable is available in $variables['my_custom_var'] within the page.tpl.php.

Is it possible to get access to this variable in node.tpl.php or any other node template?


texts: How to add a checkbox for contact page in drupal?

texts:
I added a checkbox in my register form in drupal name
"do you want a contact form?"

If the user checked it then in profile page a menu for contact is shown but if it says no then in the same page "Contact:Not Reachable " is shown.


texts: How to trim content from a heavy database

texts:
I would like to trim content from a heavy production database (1GB), to reduce transfering time, local mysql import time and generally make it easier to work with.

I know I can ignore cache, watchdog and index tables and this reduces size greatly (about 50%) and I looked into deleting old node revisions.

But I'm looking further to, for example, remove all content older than 1 year, or all users that have not been active in the last 6 months.

In the workflow these clean-up operations could be done in a (recently synched) staging environement before exporting the databse for local usage.

Anyone know how to accomplish removing older content from a database so it can be easier exported?


texts: PHP code for Block visibility by Vocabulary ID

texts:
I need to show a block for terms of a certain vocabulery. Drupal.org has this snippit for Drupal 6, but I cant find anything for Drupal 7.

http://drupal.org/node/69076

Im looking at PHP in the block visibility settings as Im assuming its the best way, but id be happy with any other solution. Thanks


texts: Best way to migrate Content from drupal 6 to 7?

texts:
Becoming more familiar with Drupal by doing a drupal 6 to 7 upgrade along with switching Ubercart to Commerce.  But the site just doesnt seem to work right.

I followed the upgrade procedure suggested by drupal but something is off

Having random errors all over the place, admins running into php memory limit errors(ex. people > permissions), missing fields, unable to add criteria to views.

Is there a better way to do this. Should I start with a fresh install and import programatically someway or with a a module?

Its a fair amount of content i have to import but would it be better just to do it manually?

Im just wondering how others go about doing this because there seem to be mixed opinions


texts: Specific Content Access only after successfull checkout

texts:
I'm creating a website where user can buy content & can view that content online.Suppose user buys a book online.Now after user successfully completed the payment process,that book should be added to user account page from where user can access the content page.Just like E-book read online,where user can only read books user purchased.
I'm using Drupal Commerce module.


texts: What is placeholder_token in html.html.twig for?

texts:
Started to dive into Drupal 8 twig, and what better place to start than from the top:  html.html.twig

But found this:

<head-placeholder token="{{ placeholder_token|raw }}">

Here is the change record:

#2565021: HTML template head, scripts, styles and scripts_bottom replaced with placeholder_token

And some related issues:

#2538950: Replace SafeMarkup::format() in template_preprocess_html with placeholders in the template
#2603074: Remove |raw from use in core templates

And the documentation:

html.html.twig on api.drupal.org

But nothing really clarifies why this was done.

Is this a Drupalism? A Twigism? What are these tokens for?

The only other time I've seen a placeholder token system like this was with CTools where they create a placeholder in the generated HTML output and then go back later and replace the token with the actual value.  If this is the same concept, why does Drupal core need to do this? (The CTools system was ostensibly to get around some core limitations).


texts: Display view field on pages with specific path alias

texts:
i have a view block - that shows 3 last images of my content type sidebar image(block is displayed on every page). Content type has two fields - image and path - url path alias, for example 'content/example'.

By default i need to show this 3 images that has been created without path(its not mandatory field) - i did this its works fine, but now when user create new node of sidebar image with path alias 'content/example' - i need to show this picture in my view  instead of one of the three default on this path.

The path can be - either view or node or taxonomy term.

I tried to create contextual filter with path field and provide default value, but kinda stuck here because its a path alias.

Any suggestions?

What i think of is to parse URL get the path, and then query to DB - and check is my path is equal to image path so i can change the query of view.


texts: I am using hook_form_alter to add few extra fields in a node. I have also managed to expose those fields in user interface using hook_field_extra_fields. All good until now but I can not see those exposed fields in views module? any suggestions?


texts:
How would I be able to supersede the hierarchical dependencies in Drupal 8's twig engine to be able to loop within the i.e Lists/Views which is assigned to a block.
So we would have a block--views-block--[machine-name]-1.html.twig template we require to have the {{ content }} variable, which then recursively buries itself down to field templates. It is completely killing me that one would need so many levels to produce on block of content.

I would like to iterate within the top custom block template the list.

Attempted

{% for key, value in _context  %}
    <li>{{ key }}</li>
{% endfor %}

To evaluate what is available to iterate down into the object but with no luck. I did though find a nice overriding object structure to reach the field attributes but that was within the field level

item.content['#item'].entity.uri.value


texts: Blocks created using multiblock module are not working

texts:
Installed multiblock module.
Create duplicated blocks (structure > block > instance > create .. ) and placed them in footer1 region.
Original blocks are in very-top1 region.

Duplicated blocks are menu links. When I click those links, nothing happens. They definitely worked before. I am not sure why they dont work now. I must done something wrong.

My site address:  http://godrupal.info/. If you scroll to the bottom you will see the all the links. Do you know why those duplicated links are not working?


texts: "Your command line PHP installation is too old" But it's not?

texts:
I was trying to install Drush version 7.x-5.9 when it gave me the following error (whenever I try to use the drush command):

Your command line PHP installation is too old. Drush requires at     [error]
least PHP 5.3.0. To suppress this check, set the environment variable
DRUSH_NO_MIN_PHP=1

My HostMonster Info:
Apache version  2.2.26
PHP version 5.4.24
MySQL version   5.5.35-log

I've reverted back to version 7.x-5.4 of Drush and the command line is working but I would like to use the newest version if possible.


texts: Using arguments in addConstraint() for validation

texts:
I implemented hook_entity_bundle_field_info_alter() to add validation to fields of a node type. I got $bundle as an argument in the hook and I need to pass it in $options argument like below:

$fields['field_tags']->addConstraint('NodeValidate', $bundle);

How can I access this argument in NodeValidateConstraintValidator? Am I passing the argument correctly?

$options provided in addConstraint can be accessed in the constructor using parent::__construct($options) in __construct() function build the options.

hook_entity_base_field_info_alter() doesn't contain a $bundle argument, as it is defined as function hook_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type). How can I validate the base field for a particular node type?


texts:
I’m trying to imports data from vBulletin into Drupal using this dev module vbtodrupal
But because the database is too large I experienced a difficult to import ALL data to drupal DB , I discovered that there is a specific limit to importing  is 300k user  ! I searched in google and found that there was a problem with "300000+ records user"

I hope to help . I did not find the response from the support module :(


texts:
I am trying to build an online print shop where user will upload their own images and select the size and quantity of the print they want and pay for the service.I want to use Drupal commerce for the backend.

I don't know how to store the images. Should I store the images as single nodes, or files entities, or products, or something else so that I can easily added them to a product or to the shopping cart?

I have tried googling a solution or something similar, but I haven't get anything.

  The issue with the images is that the same image can be re-order
  multiple times without been uploaded multiple times and also the users
  can upload and delete any of their own images at any time.


texts: how to add exposed drop-down filter with options in a view of custom table

texts:
In a drupal 7 website, I have a view that is based on a custom table. I have a status column in that custom table, which is type of integer and has 0 or 1 value, and in a view I want to add exposed filter with dropdown, with values somehow like below
$options[0] = 'No';
$options[1] = 'Yes';

So that a user can choose a value from dropdown and filter out data.
So in my views.inc file I have implemented hook_views_data(), then I have added the following code to make that field accessible in a view
$data['custom_users']['status'] = array(
      'title' => t('User Status'),
      'help' => t('User Status'),
      'field' => array(
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
  );

Now when I am trying to add exposed filter using this field I am not able to make it available as dropdown. I am only getting a textfield as exposed filter for this field.
Any help will be appreciated.


texts: How to perform COUNT aggregate function using hook_views_query_alter()?

texts:
I have fields post_date and nid in my view and I need to get count of nid upon group by post_date.
Using hook_views_query_alter(),

function custom_views_query_alter(&$view, &$query) {

  if ($view->name == 'tests') {

    $query->add_field('node', 'nid', 'count', array('function' => 'count'));
    $query->add_field('node', 'post_date', 'post_date', array('function' => 'groupby'));
    $query->distinct=TRUE;

  }
}

However the sql query in the view is displaying count(node.nid) as count and Group By date
But the table result is performing only groupby function and not count function.
I can see the date column was grouped but the nid column is still showing the nid value but not the count value.

Post Date - Nid
05/20/2015  189519
05/19/2015  189520
05/18/2015  189521
05/17/2015  189556
05/15/2015  189515

I'm expecting something like this,

Post Date - Nid
05/20/2015  3
05/19/2015  2
05/18/2015  6
05/17/2015  1
05/15/2015  3

What am I missing in the hook?
Is there any other approach to achieve this?(excluding views calc, views aggregation plus, aggregation advanced settings; These modules doesn't help me to perform filters on the values after aggregation)
Refer this link   for more understanding of my problem.
Thanks.


texts: How to translate facet filter view search assertions/statements into Russian? See the attached image. Want to write these statements in pure Russian to make friendly for the local shop customers. Thank you.


texts: How to inject a service in another service?

texts:
I am building a custom service, a membership service.
This service can be called from a controller.
But what I don't seem to get working, is to use another service, the QueryFactory, to use in that custom service.

the membership service:

namespace Drupal\hsbxl_members;
use Drupal\Core\Entity\Query\QueryFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Class MembershipService.
 */
class MembershipService {
  protected $hsbxl_member;
  protected $entityQuery;

  public function __construct(QueryFactory $entityQuery) {
    $this->entity_query = $entity_query;
  }

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity.query')
    );
  }

  public function MembershipsAll() {
    $query = $this->entity_query->get('node');
    $query->condition('status', 1);
    $nids = $query->execute();
    return "Hello World!";
  }
}

services file:

services:
  hsbxl_members.membership:
    class: Drupal\hsbxl_members\MembershipService
    arguments: ['@entity.query']

Can anyone point me out on this?
What am I doing wrong / am I missing?

Tom


texts:
Using Drupal 7 and creating a number of books with the Books module. They each have their own specific design, so specific CSS needed per book. I know I could create specific content types for each book but I think that would become unmanageable as the number of books grow.
We are using the Code Per Node module, we could make use of the Context module to detect which book it is, and then insert a block somewhere on the page with some associated CSS. In theory that would work but is there a better way to do this?


texts:
I tried below codes but nothing happen.Any ideas?

$image = image_load('/home/ok/sites/default/files/20140213030054333.jpg', $toolkit = FALSE);
//print_r($image);
 image_scale_and_crop($image, 350,700);


texts: How to get $_POST data from ajax call of a filter inside the view template?

texts:
The wallpaper listing page needs a set of filters which should display the results according to that. The filtered content is loaded using ajax callback using the views in an ajax callback

The loaded results needs to be linked to detail page. The detail page will show a slider with these filtered results in next and previous slider clicks using ajax.The post data array ($_POST) is empty while printing inside the view template.The arguments passed inside the filter needs to be printed in the view template.

Please help me in printing the post data array result in an ajax callback.


texts: How to change MENU_LOCAL_TASK title for the View and Edit tabs according to content type?

texts:
I am trying to change the title ( tab text ) of the standard Drupal menu local task tabs 'View' and 'Edit'.  I want them to reflect the content type of the current node.  So on the page node/1234 ( which is a blog node, say ) I want the View tab to say 'View blog' etc.

I can change the text using :

$items['node/%node/view']['title'] = 'View blog';

in a hook_menu_alter() function, but I can't seem to get hold of the node itself to test what content type it is to vary the text.  The arg() function doesn't return anything within the hook_menu_alter() function for some reason ?

How do I do this ?

Thanks


texts: Show fields of content type B while keeping filter criteria as content type = A in view

texts:
I am creating a website in drupal.

I have two content types first is Article and second is Author

Article contains following fields:
 Title, Body, Author-name, Language

Author has following fields:
 Name, Year, Info

Now In a view I want to show the Article name, its author-name and the year of that author!

How can I do this?
Thanks


texts: D8: The same content type, but different url path aliases pattern based on paragraphs. Possible?

texts: I have several paragraphs nested into one content type. Users can add only one type of paragraph. Is it possible to create a url alias pattern based on paragraphs? For instance, I have paragraphs "car", "bike", and "boat" in one content type "garage". If the user adds a "car" paragraph the url alias should be garage/car/etc, and for boat garage/boat/etc etc. Possible? It is generating the same url pattern for now.


texts: What is the template name for www.mysite.com/user/login

texts:
I have literally tried every combination possible, what am I missing?

page--user--login.tpl.php
page--user.tpl.php
page--login.tpl.php
user--login.tpl.php
page-user-login.tpl.php


texts: .htaccess tweak to get access to /sites/default/files

texts:
I would like to upload some files onto my drupal website like audio/video for promotion.

However, the .htaccess file in sites/default/files will not allow me. If I remove this file, it works but whenever a file is uploaded, the .htaccess is recreated again.

This is the .htaccess file. I already tried to comment line 2 and 3.

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
    # Override the handler again if we're run later in the evaluation list.
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off

Thanks in advance


texts:
As the title states, I want to export the translations in code and deploy it with a version control system like GIT.

We have a multi-language Drupal system (English and German) and we have Localization Update module installed.

While some modules doesn't even have a German translations, some are insufficient and some translations are not how we like to have them.

So I add/edit the translations using the UI under admin/config/regional/translate/translate and I can export them into a de.po file under admin/config/regional/translate/export.

I don't know really where to put this file and commit/push so that I can update the languages on other development and production environments.

We have a 3 stage development environment. Local - Dev - Pro. I do all things in local and push to Dev.

But with translations I couldn't get this workflow. Everytime I update a string's translation, I do it on every environment manually and this is not a perfect way. There must be something I'm missing.


texts: Ongoing email alerts for content "assigned" to users via Entity Reference

texts:
I have put together a work tracking/scheduling system for the company I work for - it's built on Drupal 7 and basically enables clients, projects and tasks to be added and assigned to eachother (i.e. tasks added to projects, projects added to clients) via Entity Reference fields.

These three items are set up as Content Types, and both projects and tasks have statuses (active, ongoing, complete, etc) served by Taxonomy vocabularies. I'm also using Entity Reference to enable tasks to be "assigned" to users.

What I want to do next is set up two email alerts:

An email alert to the user when a new task assigned to him/her has been added
Ongoing email alerts summarising all outstanding (i.e. status not set to "complete") tasks (this would be daily, bi-daily or weekly)

I think the first is best catered for using Rules, but I'm not sure how to tackle the second. I know it depends on filtering by status and the reference field as well as being sent out at predetermined intervals, so I know it would probably involve Rules and Cron, but I don't know where to go from there.


texts: How can I get form_ids for all forms my module implements?

texts:
I have a custom contact module that we periodically add new forms to - how can I get a list of all forms implemented by this module?

I'm integrating mollom and I want to just loop through all my forms in hook_mollom_form_list().


texts: Anonymous user having user relationships

texts:
I have come up with a peculiar problem. IO am using the User Relationships module for my Drupal 7 site. The issue is that i had given privileges to the anonymous user to view user profile. The anonymous user however cannot be a part of the user relationship but that user had clicked on that action and now somehow or other when i log in as an authenticated user and see the view which i have created to show me the users who are following me, i see i am followed(the name of the relationship) by an Anonymous user. How can i remove this. i also checked in the databases but i saw nothing regarding this...no request with user id 0. i also have all the correct permissions.

Any Suggestions

Regards


texts:
I have a product catalogue website with no commerce feature and i want to embed a contact form in every product(node). User will be able to fill that form and the owner of the website will receive an email which will also includes the title and the link of the specific node. Is there any module available that can do this?

Thank you


texts: How to disable option for users who aren't logged in

texts:
I've got custom content-type. On the main page I set teaser display of contents and I decided to show off only several fields there. Next to each content I can notice text "Read more". After entering it, I am redirected to full display of contents (There are show off all fields).

Action, described above can be done by everyone. But, I'd like to allow it only logged in users. How can I disabled it for users who aren't logged in.


texts: Prevent email from being sent using hook_mail?

texts:
I'm trying to implement an access check (a 'do-not-send' list query) just before emails are sent.
I see how to modify the message, but how do I stop a message?.

HOOK_mail ($key, &$message, $params) {
   if (TRUE) {
      // -- Stop Message From Being Sent Here -- //
   }
}

Is break; adequate?


texts: Rule set username after changed user email

texts:
I need an email registration system only in my drupal site.

I installed the module email_registration and I created a module like this http://www.grasmash.com/article/using-your-email-address-your-drupal-username to set the username like the own email address.

Now my user has: name: fra@ore.com email: fra@ore.com
But if the user changes is email address the username doesn't update. So if fra@ore.com changes his email to fra@ore2.com the username remain the same.

I tried to update the username by the Set a data value of Rules module After updating an existing profile but I dont know how set this action... Can you help me??


texts:
When taking a quiz with multiple questions, how do I get the current question's NID? The URL only contains the quiz' NID (node/1234), even when I started the quiz there only this NID is available (node/1234/take/1). When I node_load(arg(1)) there also is no clue of how and what questions are mapped to a quiz.

quiz-7.x-5.0-alpha10


texts: How can I edit the html of the title of my node page

texts:
I have a content-type "foo" and some nodes with that type. Now, if you go to one of the node pages, e.g. /node/22, you see the node title as the page title.

I can edit the html of the whole page using node--foo.tpl.php but I can't edit the title/titles html.

How can I change the html of the title div on such a page for a specific content-type?


texts:
I have a form that has a field with conditional validation. I mean if a certain radio button is checked, then the field need to be required.
Please find below a code snippet of how I tried to solve it. Unfortunately, when I run this code, the field disappears, and when I comment out this logic, the field appears again.

I implemented the code from https://api.drupal.org/api/drupal/core!includes!common.inc/function/drupal_process_states/8.2.x.

/**
 * Implements hook_form_FORM_ID_alter().
 */
function MYTHEME_form_user_register_form_alter(&$form, FormStateInterface $form_state) {

  $form['the_field'] = [
    '#states' => [
      // Only make the field 'the_field' as required when the 'field_of_type_radio' value is equal to '1'.
      'required' => [
        ':input[name="field_of_type_radio"]' => ['value' => '1'],
      ],
    ],
  ];

}


texts: How to differentiate token replacement from array index

texts:
How to escape left square bracket - [ and Right square bracket - ] when used in views so that it is not mistaken for a token.

I have what I hope is a simple question to answer. I have tried searching online but have been unable to find an answer (perhaps using the wrong search terms - I don't know). I am using Drupal 7 with views and the fillPDF module. I have modified one of the outputs of my view to use token replacement. The issue I am having is that the string that is being used for the token replacement has an array with an index that is the same as the token. Here is the code:

Create a PDF

As you can see, I need away to make sure webform[nid] and webform[sid] doesn't become webform1 and webform2 after token replacement. How do I accomplish this? There must be a way to escape the array.

Thanks.


texts: Drupal 6 database has mixed InnoDB & MyISAM. Need to fix before migration

texts:
I have a Drupal 6 database with tables which are a mixture of InnoDB and MyISAM. I'm using the Acquia Dev Desktop stack. The core module and other tables created at installation are MyISAM, and the tables for modules I've since installed are InnoDB. I didn't think at this issue when I started this project, and need to move my Drupal site to a new dev. environment I created on WebEnabled. So I have a couple of questions:

Since my Acquia MySQL default settings are set to InnoDB, can I safely change this to MyISAM without causing problems within my site?
I tried using the DB Tuner module to change all my tables to MyISAM. It worked but then I checked the status report and it said that all those tables that were converted were now "mis-matches". I restored from a backup at that point. Am I going to have to uninstall all the contributed modules and re-install them as MyISAM to avoid getting mis-matched errors.

Thanks a lot.

Jason


texts: How to programmatically create views in Drupal 7

texts:
How do I programmatically create views in Drupal 7?

I would like to create a custom module that would output data as a view.

Is there any documentation on how to output views from a custom module?


texts: Showing Warning for viewing adult classified content

texts:
I am developing one publishing website, where authenticated users can write the article. For each article, he sets the age group for which the article is targeted for. Different age group may be "Adult","Pre-teens" and "Everyone". I have used taxonomy to age group.

Now, I want to show warning message to the user, when he goes to any "Adult", classified article page, before loading the content, and get the confirmation from the user that he is 18+ to view this article.

Please suggest how, can I implement this or is there any module that helps me to achieve this.

Thanks for your time.


texts: How to programmatically create new file/folder in Drupal 7 files directory?

texts:
I tried to create new file/folder programmatically inside Drupal's sites/default/files. But I'm getting this error: "Can't Open file".

Here is what I'm doing: When my registered user visits a certain page, I will be generating a new file and I will provide them with the download link. When I tried to create a new file I am getting "can't open file" message. I'm in localhost in MS Windows.

Are there any other writable folder other than sites/default/files for doing this stuff?

Below is my code:

$ourFileName = base_path()."/sites/default/files/members-pdf/testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

Above code is written inside a views's template file.

I want to use PHP file API and not Drupal 7 file API.


texts:
Is there a way we can add some fields in Blocks, just like we can do in content types. For now I need an image field attached to a block.

I know about a module named Image Block but that is limited in its functionality.


texts:
I have recently come to begin to work on a site built by someone else, so I have no idea of what specifics may have been done when building this site I am referring to. At the moment, I'm trying to revamp the structure (as well as the look to play around with it in sections), and came across an interesting problem.

In the view, I have three exposed filters: 1) Object ID 2) Title 3) Keywords (from the Search:Search Terms filter).

Now when I type in the Title filter, everything works as expected. And when I type in Keywords filter for something that would be somewhere besides the Title, that works as well, with the exception of dates and numbers that aren't in the Title Field.

You can find this page here http://history.arvadahistory.org/photographs1

You will notice that each content type has a picture, then a blue title, then a black string of letters and numbers. An example being this: HF.00668

Now, when I type this (HF.00668) into the Object ID filter, I get absolutely nothing, but when I go to type this in the overall site search, the proper content pops up.

So why would my filters be acting like this? And is there any way to fix them?


texts: Different registration procedures (with or without approval) for different roles?

texts:
I am currently setting up a simple LMS in D8 and would like to create different registration procedures for different kinds of users. In particular:

There should be a registration page for simple member profiles: Only basic user data should be required and the account should be unlocked immediately after registration (and e-mail confirmation).
There should be a second registration page for student profiles: They need to upload a valid student identity card, which is why their registration requires admin approval.

I have already set up different registration profiles/pages for members and students and after registration the correct role is automatically assigned to the new user. So, that is working well already.

However, I need to also set up a different approval process, depending on the registered role and I'm not sure, how to approach this. Note: I really don't want this to be a two-step process, where students register as members first and only then upload the required documents. I need to make this as easy and quick as possible for them, while at the same time allowing for unrestricted member registrations.

Note that I'm working in D8 and I'm hesitant to install the Rules module, as there doesn't seem to be a stable version yet. Or is it usable?

Can this be done? Any help?


texts: How to hide Header and footer printed page?

texts:
I'm using drupal 7 with print module,when printing some node there is some extra content like (date , pager and url) in the header and footer page that will be printed.
I just want to print the content of the node.
How can i remove this content?


texts: Gmap, Views Draw Lines on Field Collection Locations Map

texts:
I have built a website for car tours. There are multiple tours throughout the year, and new ones are added regularly. Here is a quick outline of the website...

Content type: "Tour Page", Fields: Field collection item, allows multiple tour steps to be added. Each field collection item has a Gmap find address on map location field.

On each tour page, I have a view Gmap using a contextual filter to get a default value of Content ID from URL. This displays the tour steps as single icons. This view is in a block, and set to display on all "Tour pages".

I would like to draw a line on the map from point to point. It can be a straight line, going from point to point.

Now, I can edit the view, go to gmap settings, and enter my own lines using the macro for the view, like this...

[gmap line=#0000ff/5/45:51.512099,-0.15169000000003052 + 51.20086,3.2629389999999603 + 50.654685,4.833983999999987 + 50.403266,6.240233999999987 + 49.966239,8.18481399999996 + 49.067118,8.10241700000006]

...but this will output the same lines for this view on every tour page. But of course, the route is different for every tour.
Here is where I am so far...

http://www.dev.ducktoursinternational.com/tour/maranello-monaco-monza-grand-prix-tour-2009

...The line is on the map, following the points. But this same line is in the same place on every tour.

I have all of the latitude and longitude values for all of the points collection in the field collection location fields, is there a way to create a unique macro for every map using these values?

I can probably use a "master" view to assemble all of the lat and long values into the right format for a gmap macro, but how do I get that macro to apply to the different route on each page?

Some more information...
1. Here is the tour page with the current macro on it... http://www.dev.ducktoursinternational.com/tour/maranello-monaco-monza-grand-prix-tour-2009

Here is a screenshot of the gmap view...

Here is a screenshot of the views GMap Settings

So I have a block with a map, and a block with the correct macro for that page. How do I use that macro for that map?


texts: How to allow direct user input links the Facebook way?

texts:
Does Drupal offer the possibility to have users input a link the Facebook way? In other words, showing directly a summary kind of view of the linked page?
Thanks.


texts: Is there a Node Reference URL Widget module for entity references?

texts:
I just learned that there is the nice Node Reference URL Widget module.  Basically, it allows you to add a add a A link in the node view pages of content type B, if there is a node reference A->B.  When you are viewing a B node, clicking on the add a A link would lead you to the node creation page of content type A, with the A->B field populated with the B node you were just viewing.  That way the user do not need to figure out "which node B am I adding this node A to?"

Our sites mainly use Entity Reference.  Is there a module that provides similar functionality for entity references?


texts:
I created a Media Gallery on my Drupal 7 site and I am using views to output the teaser of all my galleries. Everything works as expected, but the gear menu is missing, that enables the user to delete images from the gallery. The documentation page describes this menu:

Does anybody has an idea what to do?


texts: How to use element validation and form validation on the same form?

texts:
I have a custom form I am validating with a custom validation function like this:

…
$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#validate' => array('custom_misc_form_validate'),
  );

This works as expected, my custom validation function is called, etc. But I would like to add an further form element to the form, which defines an element validation callback function, like this:

$form['email'] = array(
      '#type' => 'textfield',
      '#title' => t('Email'),
      '#description' => 'Bitte geben Sie eine gültige E-Mail-Adresse an: An diese Adresse werden Ihnen die Zugangsdaten zu unserem Intranet zugesandt.',
      '#required' => TRUE,
      '#element_validate' => array('custom_misc_email_validate'),
      '#weight' => -998,
    );

The validation callback looks like this:

function custom_misc_email_validate($element, &$form_state, $form) {
  $value = $element['#value'];

  // Check if email has a valid format.
  if (!valid_email_address($value)) {
    form_error($element, t('The e-mail address %mail is not valid.', array('%mail' => $value)));

  // Check if email address is already registered.
  } elseif (user_load_by_mail($value)) {
    form_error($element, t('The e-mail address %email is already registered. Have you forgotten your password?', array('%email' => $value, '@password' => url('user/password'))));
  }
}

But the callback for the element validation is not called, as long as there is an callback in #validate of the submit button. As soon as the latter is commented out, the callback for the element validation is actually called, but $element['#value'] is always empty.

Is this a bug, or am I doing something wrong?


texts:
Is there a method to limit the number of chosen select options?
In D7 there was Webform Select Limit but in D8 there is no alternative.

What I want to do is this:
Create a webform for event registration with maximum number op places.

NAME: ____
EMAIL: _____
WORKSHOP:
 A. Option 1 (maximum 20 places)
 B. Option 2 (maximum 20 places)
 C. Option 3 (no maximum)
 ....

SUBMIT


texts:
I'm using the core taxonomy module for blog tags but when on a tag's page can only get the breadcrumb to appear as 'Home', whereas I'd like it ideally to be 'Home > Blog > #Tag#'. I'm using custom breadcrumb module to set breadcrumbs for content types (<- doesn't allow for taxonomy breadcrumbs) and have tried using taxonomy breadcrumb module with absolutely no result, partly due to the fact that it's not a particularly configurable module. Blog tag pages (listing all the nodes under a term) seem to be generated from the core taxonomy module and not views so I can't resolve the issue in views.

If anyone could point me in the right direction I'd be grateful :)


texts: Module configuration screens not appearing

texts:
Update 2020.05.29:
I've rebuilt the whole of my development site from the ground up, and I've just run into this issue again. I set up git on my production site and cloned the file system (now Drupal 7.70) to my local MAMP environment. I'm using CiviCRM, so I've added civicrm.settings.php to .gitignore, as well as .htaccess, because the configuration on my live sever is different. I installed Drupal, CiviCRM, and a host of other modules no problem. The local site was running fine.

It became apparent that I really needed to test with some of the content from the production site in place to accomplish what I was trying to achieve, so I exported the database on production using Backup and Migrate and imported it locally. I got all the content in just fine, but Backup and Migrate's config screen itself started displaying an error, so I tried disabling and re-enabling the module. Backup and Migrate has now disappeared from the site menus. I've tried installing a couple of other modules, but they don't install correctly either. I see exactly the same behaviour I described below.

Module installation on the production site still works just fine. But whatever the problem is must come from the production database, 'cause neither settings.php nor .htaccess have changed from the version that was working just fine before the database import.

Any ideas?

Original post:
I'm relatively new to Drupal and I'm trying to make a local copy of a Drupal site 7 site I administer to test some new modules. I thought I had got it working, and the site seems to load without errors, but whenever I install a new module the configuration screens aren't available.

As an example, I've been trying to install the CKEditor module. The installer reports that it's completed OK, and it shows as enabled. If I try to create new content, the CKEditor toolbars appear on the editor as expected. But the configuration screen doesn't appear anywhere in Drupal's menus, and if I try to navigate to /admin/config/content/ckeditor it just resolves as /admin/config/content.

I've tried clearing the caches, and several different browsers, but nothing's making any difference. If I try creating a site from scratch in MAMP everything seems to work fine, and if I install on the live site it seems to work. It's only my local copy of the site that has the problem.

Drupal 7.69. MAMP 5.5, and the site is also using CiviCRM 5.22.

Any suggestions? Thanks!

Edit 2020 02 21: I'm still not getting anywhere with this, so a few more details of what I've been trying in the hope that someone can help me.

My development site is at

/Applications/MAMP/htdocs/devfolder

I have the following line in settings.php:

$base_url = 'http://localhost:8888/devfolder';

And this in .htaccess

RewriteBase /devfolder

I've been playing about with variations on those, commenting lines out and reinstalling the affected modules, but it's not making any difference.


texts:
For EXIF I need an image metadata field that I can use to upload multiple taxonomy values (gallery/category) for an image content type. Apart from keywords which I am using as such I need another field that will link to the gallery taxonomy - an image can appear in several galleries.

At the moment keywords seems to be the only field that EXIF uses to populate multi-valued taxonomy fields. If I add 2 values in IPTC CATEGORY say separated by commas or semi-colons (e.g. News, Sport) it creates a new combined taxonomy value of "News, Sport" in the vocabulary, not what I want.

Any suggestions? I am using EXIF on Drupal 7 - both latest versions.

Since initially posing the question I tried using EditableViews modules in the hope it would allow me to edit the gallery entries but it would not let me edit the fields although it did display them.


texts: Views show list of nodes that have referenced node on another content type

texts:
I have research and people content types.
In people content type I have nodes that are authors for researches.
I referenced author name field on research content type to people content type.
Now I want to show all people type nodes that referenced in research content type nodes.
In another word I want to show list of all my authors from my people content type.
Thank you very mach.


texts: What parts go under source code version control?

texts:
I am wondering what the best practices are for putting Drupal code under version control. I'll be mostly using core and standard Drupal modules. I'll be developing a custom theme, and one or two custom modules.

As far as I see it, I have 3 options:

Put the entire Drupal folder under version control. Developers can directly check out the folder in the Apache htdocs folder and go from there.
Check in only my custom code (modules + themes). Developers checkout the code in the appropriate folders.
Set up something like Docker.


texts: How to create a Sub-theme based on a Zen Sub-theme

texts:
I would like to modify the CTI Flex theme but would prefer to keep my changes as maintainable as possible. CTI Flex is already a Zen (7-x.3-x) sub-theme.

I have used the Zen starterkit in the past to create a Zen sub-theme, but never a sub-theme of another sub-theme.

How do I create a sub-theme of using another Zen sub-theme as a start point?


texts:
I'd like to have a graphics-oriented Webform, wherein the user will select from check boxes that have a specific image associated with each. For instance, I might have a row of checkboxes with a color swatch above each one, like this:

[red jpg color swatch] [blue jpg color swatch] [green jpg color swatch]
[checkbox].................[checkbox]..................[checkbox]

How can I accomplish that using the Webform module?

Thanks!


texts: How to create groups and assign users to them using Organic Groups?

texts:
I have downloaded the Organic Groups module for my Drupal project and am currently trying to create groups and assign users to them.

I don't want anything fancy. I just want to be able to create groups, have the user assigned to them by the main administrator (not allow the user to register themselves) and have the assigned 'leader' of the group be the only one within the group with edit/etc permission.

I am unsure how to start. I found the resource Organic Groups: Enable users to create collaborative groups that looks really good, but I think it is for an older version of Drupal because the OG sections I have found are in a different location than the site says.

How do I do this?


texts: How do I move files and directories after installation?

texts:
I moved directory within a server so the Drupal 8 installed URL should change from ip-address/old-folder/d8 to my-site.com/d8/.

When I checked the new URL, the front page worked, but other pages gave a 404 error that said old-folder/d8/admin/structure/.

I read Moving drupal to a subdirectory, but the answer there didn't resolve my problem.

Which file/config I should change in Drupal 8.6?


texts: Creating a user using Services results in user not being able authenticate using HTTP Basic Auth

texts:
I'm developing a backend for an Android application using Drupal, and I've run into somewhat of a weird problem. I'm using Services and Views for the input and output of various content types. In order to make requests to the Services module, the users need to authenticate using HTTP Basic authentication.

When users create a new account in my app, I use the Services endpoint to create the new account using data that the user enters himself. However, the password that gets send to the endpoint is not the same as the password that gets saved.
This results in users not being able to authenticate other requests using HTTP Basic Auth with the password they set, as Drupal does not recognize the password. However, logging in using the Services endpoint DOES work with the set password.

When changing this user's password manually in the Administration panel to the value they set in the app, the HTTP Basic auth requests suddenly work, and they can still login using the Services module as well.

What's going wrong here, and even better, what can I do to remedy this problem? I'm not looking forward to changing every user's password manually so they can use the rest of my backend, and dropping the HTTP Basic Authentication is not an option either.

Edit:

Further investigation has shown that it's also not possible to login to the Drupal frontend using an account created by the Services endpoint, unless you change the password manually.


texts: How do I set a dynamic variable in the menu links yml file for route_parameters?

texts:
I'd like to create a menu item that has a dynamic variable in it, specifically the user's id.

In my example.routing.yml I have this:

example.test:
  path: '/user/{user}/example'
  defaults:
    _controller: '\Drupal\example\Controller\ExampleController::test'
    _title: 'Test'
  requirements:
    _permission: 'access content'
    user: ^[0-9]+

In my example.links.menu.yml, I have:

example.testlink:
  title: Test Link
  parent: example.parent
  description: 'Test Link'
  route_name: example.test
  weight: 3
  route_parameters: {user: 5}

That "5" is my user id, I'd like to have it pull dynamically from my logged in user.  Is that possible?


texts: How to select a node reference field when querying the database

texts:
I am using db_select to query the database to get some fields, one of the fields is a node reference and I don't know how to select it or join its table.

My content type contains a node reference, and this node reference contains another node reference (nested relationship), how can I from the original content type get the first node reference fields and the fields of its node reference ?

My current query :

$query = db_select("node", "n");
$query->fields("n", array("nid", "created", "type"));
$query->fields("f1", array('field_field1_value'));
$query->fields("f2", array('field_field2_value'));
$query->leftJoin('field_data_field_field1', 'f1', 'f1.entity_id = n.nid');
$query->leftJoin('field_data_field_field2', 'f2', 'f2.entity_id = n.nid');
$query->condition('n.type', 'my_content_type', '=');

$query = $query->orderBy('n.created', 'DESC');
$query = $query->extend('TableSort')->extend('PagerDefault')->limit(20);
$result = $query->execute();


texts: Is there a printed map / tree / graphic of a sample array(s) during each phase?

texts:
This is a larger question to help me better visualize the Drupal array structure at each 'stage' of the life cycle. I'm looking for material to help me see what's happening behind the scene that center on the array structure exposed to the various hook calls.

Does anything exists in this fashion? I guess something could be pieced together by examining the APIs, but at it's core (version 7 at least), Drupal is about letting various components authored by different individuals to flexibly alter array(s) before their final HTML render.


texts: problem with template hook suggestion for user profile

texts:
I recently did install a Drupal theme and did take the default views for contents to view user profiles it works properly till you click on the link to the user profile the Ajax loads a blank page , but when I try the same view without the theme's view formatter it works properly tried adding hook suggestion for user profiles but nothing seems to work.

How do I solve that?

Here's the default code for hook suggestion

function other_preprocess_page(&$vars, $hook) {
  if (isset($vars['node'])) {
    $suggest = "page__node__{$vars['node']->type}";
    $vars['theme_hook_suggestions'][] = $suggest;
  }

  $status = drupal_get_http_header("status");
  if($status == "404 Not Found") {
    $vars['theme_hook_suggestions'][] = 'page__404';
  }

  if (arg(0) == 'taxonomy' && arg(1) == 'term' ){
    $term = taxonomy_term_load(arg(2));
    $vars['theme_hook_suggestions'][] = 'page--taxonomy--vocabulary--' . $term->vid;
  }
}


texts: Change "Add new node" and "Add existing node" button labels in inline entity reference forms

texts: I am using inline entity forms to allow users to add or reference existing location content to event content from the front end and am very pleased with how this works. I would really like for the buttons to be labeled slightly different here with the labels reading, for example, "Add new location" rather than "Add new node" which is currently a bit confusing for users. Is this possible, even if this was a theme hook that only changed the label in the front end? The solutions for Drupal 7 don't seem to work in 8.


texts: How to write a rule for 'After sending email'?

texts:
I have to write a rule for the event 'After sending email'. How can I do that?

For example there are three users user1, user2, user3. I need to enable a flag on a content type after admin sending email to those three users.


texts: Is it possible to change all node assigned on TermA to TermB?

texts: We are going to delete TermA, and there are a lot of pages under TermA. How can I assign those pages into TermB (already exist) without manually one by one?


texts:
I have created a webform a few days back. Now I want to re-use the webform which I created earlier with other results, so to save my time and energy I just want to clone that webform and reuse for a different purpose.

Note: previous webform has some result. However I do not want to have this result in the exported webform, I only need the form.


texts: How do you add the NID as a view filter criteria and not contextual filter?

texts:
I'm using an Entity Reference field, displayed as a View, to select an "Work Entry" node type. The Work Entry nodes are selected when creating/editing an "Invoice" content type. So the user will be able to select or deselect Work Entries as needed.

My problem is when using Contextual Filters to pass the NID (Content ID from URL) it removes my other filter which is set to NID = Empty. I would like to display all Work Entries selected by current node or ones that aren't connected to any node. Hopefully this makes sense.

Any suggestions, thoughts, etc.? Drupal has so many ways to do the same thing, I may be approaching this from the wrong direction.


texts: How can I save 30,000 nodes in less than a day?

texts:
Recently I have written a module that reads contents from a file; downloads associated image files; and then saves that to the Drupal 7 as a new node using node_save.  The script works fine, but the minute I start the script I have about 16 to 24 hours before it would finish all 30,000 entries. Yea, that's way too long.

What are some suggested design patterns for my module to finish this as fast as possible? Here is the current architecture:

$items = getArrayOfItems();    //reads file and gets an array of items
foreach ($items as item) {
    $node = new stdClass();
    $check_exits = check_title_exits($item[title]);    // note: call to database
    if(!$check_exists) {
        populateNodeObjectFields($item);
    }

    if($images = hasPhotos()) {    //note: must dl up to 4 images from web using CURL
        //create file object and apply to node image field
        $node->image_field = $images;
    }

    //do final custom validations
    validate($node);

    if($node = submit_node($node)) {
        node_save($node);    //note: call to database
    }
}

Everywhere I have a note I believe is a bottleneck. Here are my theoretical thoughts on improving the speed.
1) instead of checking against the database for a title (exists) load all titles into an array and check against the array
2) maybe I can separate the file downloads for a separate process to handle later after the node has been saved?
3) This is the biggest bottleneck.  If I am understanding the Drupal API correctly, this opens a connection and saves the node one by one - or more than 30,000 times. How can I just open up one call to the database and save all nodes in one batch?

My original solution was simply to have multiple scripts run simultaneously and be responsible for a certain chunk of the data. 12 scripts for example should have cut it down to 2 hours tops for all the data.  The problem with that is I keep getting PDO exceptions - serialization errors.  Please see this link where I wrote about it. PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock;.  If I could fix that, I would be happy to continue with that solution.

Thoughts on the best way to approach this?


texts: Importing an Excel file, every column as specified field

texts:
My installed modules: feeds , feeds_xls

My excel file is : books.xlxs (office 2007)

File sheets: my file have 15 sheets (this sheets must be as drupal taxonomy term)

Every sheets involve 6 column (this column and its contents must be as drupal field content)

I created a drupal content type with books name.

I have attached an image to this post. you can see it.

I want to import ecxel file into Drupal content.every row on this tables must import to drupal as a node) content).

books Excel file image - click here

I no have any taxonomy term and extra fields to my content type (book). if I should add fields to drupal content type please say me.

I want to have a book list on my drupal site that users can search on it. every row is a content and every column in file is one field.


texts: Inserting a form into a block in Drupal doesn't work

texts:
I am creating block module in Drupal 7.

In the body of block I want to put the form which will restripe the data of table in forms.

I have created block as shown below but it doesn't showing the form.

<?php
/**
 * @file
 *  This is module file which display the links on the welcome page.
 *  This module will create a block of the link which is to be displayed on the welcome page.
 */

/**
 * Implements hook_block_info().
 *
 * This hook declares what blocks are provided by the module.
 */
function welcomepage_links_block_info() {
  $blocks['user-filter-ajax'] = array(
        'info' => t('User Filter'),
        'cache' => DRUPAL_CACHE_PER_ROLE, // default
  );
  return $blocks;
}

/**
 * Implements hook_block_view().
 *
 * This hook generates the contents of the blocks themselves.
 */
function welcomepage_links_block_view($delta = '') {
  //The $delta parameter tells us which block is being requested.
  switch ($delta) {
    case 'user-filter-ajax':
        $block['subject'] = t('User Filter');
        $block['content'] = drupal_get_form('restripe_command_example_fieldset');
        break;
   }
  return $block;
}

function welcomepage_links_form() {
    $form = array();
    $form['restripe_command_example_fieldset'] = array(
        '#type' => 'fieldset',
        '#title' => t("Demonstrates the Ajax 'restripe' command.")
);
    $form['restripe_command_example_fieldset']['restripe_num_rows'] = array(
            '#type' => 'select',
            '#default_value' => !empty($form_state['values']['restripe_num_rows']) ? $form_state['values']['restripe_num_rows'] : 1,
            '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
            '#ajax' => array(
                    'callback' => 'user_filter_ajax_restripe_num_rows',
                    'method' => 'replace',
                    'wrapper' => 'restripe_table',
            ),
    );
    $form['restripe_command_example_fieldset']['restripe_restripe'] = array(
            '#type' => 'submit',
            '#value' => t("Restripe the table"),
            '#ajax' => array(
                    'callback' => 'ajax_example_advanced_commands_restripe_callback',
            ),
            '#suffix' => "

first row

'Restripe' Command Status: Unknown
",
    );
    return $form;
}


texts:
I'd like to create a form with tabledrag, with some fancy client-side behavior when (after) a row is being dragged.

More specifically: If row A is being dragged, I want to change an indicators on row B, depending on the new position of row A.

The classical solution would be a jQuery event that fires when a row is dragged. But which event is that, and to which element does it bind?

UPDATE

2pha pointed me to this page, which is nice:
http://drupalapi.attiks.com/api/drupal/misc!tabledrag.js/7

So the remaining question is, how to use these commands?

$('table#the-table').onDrag(..)

would that be it?


texts: How to reset UID number back to default order?

texts:
I have a Drupal 7 website with only UID1 user which is root admin. I deleted previous users. Now if I create a new user, it gets UID of e.g. 74.

It should be UID 2 and so on.

Anyway, I had same problem with resetting nodes back to 1. And I did it by following this answer, but it worked only if you have no nodes. Now, I have at least one user and I don't know if that query would work for 'users'.


texts:
I'm update user profile data via services 3 but I have a problem with user picture. I send user picture to my web site via services and it works:

{"fid":"1078","uri":"http://MyDomain/rest/file/1078"}

But how can I pass this "FID" to the user update method ? Which is the correct parameter name ?

Thanks.

M.


texts:
I'm using panels to display user profiles and each profile has a 'follow' flag (non global).
I've used a view called 'follow-users' to capture few users and one of the field within that
View is the same 'follow' flag link.

When someone flags a user within 'follow user' view the flag on user profile still stays unflagged

Can anyone please help to figure out why it’s happening?

Thanks


texts: Change Bootstrap column classes based on the result of a view

texts:
I have a D8 site with a Bootstrap 3 subtheme and two columns with one region and a block inside each.

I need to change the first column width (col-md-12) to take 100% width when the view block in the second column is empty, and to take just 50% (col-md-6) when it has something to display.

An easy way to achieve this without custom modules?

With this solution I can hide the second region, but how to make the regions talk together and change the first accordingly?
Should I make one single region with two blocks within and then change column classes in the region twig template? Is it possible?

Thanx for your attention


texts: How to get a JWT token when not logged in

texts:
If I am logged in (have a session cookie) and make a GET request to /jwt/token, then I get a JWT token.  How do I get the token if I am not logged in?
This article by Preston So states:

As a logged-in user, or when you issue a GET request against
/jwt/token with credentials of a user with the appropriate
permissions, you will receive a token like that seen below, with which
we can issue authenticated requests to Drupal.

So this is what I tried in Postman:

GET: example.com/jwt/token
Headers: Content-Type: application/json
Body: raw: {"name": "myUsername", "pass: "password"}

This resulted in an "access denied" message.
I also tried using form-data and x-www-form-urlencoded for the Body, but those didn't work either.
I know JWT is configured correctly because if I log in first in Postman (get a session cookie) and then try the request, it gives me the token.
So what can I use in Postman to get the token from /jwt/token when I'm not already logged in? (How do I provide my login info to Postman?)


texts:
I need to create a module that when visited with some get parameters in the url to be able to create user with specific roles in the database.

So if someone visits mydomain.com/my_custom_module/create/john/smith/role_id/filename_that_includes_hidden_token_for_validation

Will create the user John Smith with a role specified by the id passed and in order not to allow anyone to create users I have a temp txt file with a random generated name where I keep a token

Is that possible? Is there a better way?

Thanks in advance

EDIT

Why I want a module like this:

I have a site written in cakePHP and the need for a forum came up. The client heard that drupal's advanced forum is the best solution (I've tried to persuade him to use phpbb with no luck...) but he wants the forum to be private and to give access and roles to existing members from the cakePHP's site admin. So I'll provide him an "give forum access to member" button which will redirect to the url described above after I've created a temp file with a hidden token somewhere in the server for security issues. I don't know if it is the best way to do this.


texts: Why book re-ordering is not being saved?

texts:
I'm using Drupal 7.38. When I re-order book pages and then hit the Save button, the ordering stays the same. If I open individual nodes and change weight of each one then it works, but that will take a lot of time.

Any idea why the re-ordering is not being saved?


texts: check box with dynamic content and error with submit handler

texts:
I have written a form that displays data with check boxes, I want the selected values to concatenate into a string. From the submit button the string would be passed as a URL.Inside the submit handler I tried navigating to localhost but the page doesn't navigate.I this error 'An illegal choice has been detected. Please contact the site administrator.'

Note: I am using a third party software which opens a port on the server and accepts the concatenated values.

  function basket_form($form, &$form_state) {
 // Build Breadcrumbs.
    $breadcrumb = array();
    $breadcrumb[] = l(t('Home'), '');
   // Link to current URL.
    $breadcrumb[] = l(drupal_get_title(), current_path());
   // Set Breadcrumbs.
   drupal_set_breadcrumb($breadcrumb);

   // Check for empty session.
  if (!isset($_SESSION['basket']['items'])) {
      drupal_set_title(t('Your basket is empty'));
      $form['empty'] = array(
      '#type' => 'markup',
      '#markup' => t('There is nothing in your basket at the moment.'),
     );
   }
  else {
    $form['clear'] = array(
    '#type' => 'submit',
    '#value' => t('Clear the basket'),
    '#name' => 'clear',
    '#href' => 'basket/clear',
   );

    $form['items']=array(
    '#type'=>'fieldset',
    '#title'=> t('Select from the following')
    );
    foreach ($_SESSION['basket']['items'] as $nid => $data) {
    GLOBAL $url;
    if(strlen($nid)!=0){
      $values = array(
     'biomaterial_id' => $nid
      );
     $features = chado_generate_var('biomaterialprop', $values);
     foreach($features as $f){
       if (preg_match("/bamURL/", $f->type_id->name)){
          if (preg_match("/http/", $f->value)){
             $url=$f->value;
            }
          }
       }
      if(strlen($url)!=0){
        $form['items'][$nid]['name'] = array(
        '#type' => 'checkbox',
        '#title' => t("$data[name]"."(bam))"),
        '#options' => array (
         $url => $data['name']
       ),
     );
   }
    else{
       $form['items'][$nid]['name'] = array(
       '#type' => 'checkbox',
       '#title' => t("$data[name]"),
     '#options' => array (
          1 => $data['name']),
      );
    }
   }
 }
   $form['submit'] = array(
      '#type' => 'submit',
      '#value' => 'IGV',
   );
  return $form;
 }

function basket_form_submit($form, &$form_state) {
    //concatenation help, I tried printing $form_state couldn't see
     anything.
    //"drupal_goto('http://localhost')
    drupal_goto('http://localhost:60151/load?file=concatenated string')
   }
 }


texts:
I inherited maintenance of a Drupal 7 site and I don't have much experience with drupal but there is a content type called 'Materials' that we would like to be able to view it's listing representation in different languages.  So /materials lists everything in English, but /es/materials should list everything in Spanish but it has both Spanish and English entries.  How can I eliminate the English entries so only Spanish ones will show.  And, why are English entries displaying in the first place?

Here is the language config for the Materials content type, followed by the Materials Views configuration:


texts: I'm trying to show a map with multiple markers with the help of Views and Geolocation field. It would be nice for example if I can show the image in the tooltip display of the marker. But when I add an image as a field to achieve this, the image automatically gets selected as the icon source field by default (See Views UI - FORMAT - Advanced settings). Is it possible change this behavior?


texts: Problems with Contextual Filters & Menu Tabs

texts:
I have created a collection of views (base) that collects identifies a category of articles and a second single view (tabs) that creates tabs to filter the content into sub categories for all base views using contextual filters.

I have created two vocabularies to contain terms for Section and part.
A sample base uses the path /division/SectionTerm.
The path for the tabs view is /division/%1/part.
Each page of the tabs view has a filter to a specific part term.

The idea is to have a series of menu tabs that display different related content related to a section.  This works fine in a test without the contextual filter, but the tabs do not show when I change to contextual filters for the tabs view although the preview is showing correct results.

I am having a similar problem having a view block using relations appear.  See separate question post.


texts:
I am unable to get a button to work as I intend it to in Drupal 7.

I am adding the button to the add content page of a specific content type using form alter:

function charlie_get_form_article_link_node_form_alter(&$form, &$form_state, $form_id) {

    $form['add_button'] = array(

        '#type' => 'item',

        '#markup' => '
            <script>
                function getArticleInfo() {
                    jQuery.get("articlegrabber.php?url=TEST", function(articleHTML) {
                        console.log(articleHTML);
                    });
                    return false;
                }
            </script>

            <button type="button" onclick="getArticleInfo()">
                Submit URL
            </button>

        ',

    );

}

I have simplified the articlegrabber.php file down to just this (though I don't think it matters, because the button click does not seem to be executing the JS):

<?php

$ogLink = $_GET['url'];

echo $ogLink;  ?>

Instead of my intended results (which the code delivers independent of its implementation in Drupal), the console logs the HTML for the add content page that the button is on.

I have read a lot about how Drupal likes to make all button types "submit", but my button is actually rendering as type="button". The HTML from the rendered page (as you would expect):

                    <script>
                        function getArticleInfo() {
                            jQuery.get("articlegrabber.php?url=TEST", function(articleHTML) {
                                console.log(articleHTML);
                            });
                            return false;
                        }
                    </script>

                    <button type="button" onclick="getArticleInfo()">
                        Submit URL
                    </button>

Any ideas about how to get it to execute the code on click rather than returning the HTML for the page would be much appreciated.


texts: How to write SQL Statements With Spaces In Column Names

texts:
Hi I am trying to write a Dynamic Query to get data from the database but I am facing issues to write a query for column names with white spaces.

My Product_Details Table looks as below:

| S.No.  | Product line   | Product type  | Product   | Year  |

| ------ |:--------------:| -------------:|----------:|------:|

|   1    | Camp Equipment |  Cooking Gear | Cook Set  | 2015  |

|   2    | Golf Equipment |    Irons      | Titanium  | 2014  |

My SQL Looks as below:

$query = \Drupal::database()->select('Product_Details', 'n');
$query->addField('n', 'S.No.');
$query->condition('n.Product type', 'Irons');
$results = $query->execute()->fetchAll();

But I am getting  Syntax error or access violation.

While looking into the error log after SQL Query executed I found out this:

  1: SELECT n.S.No. AS SNo FROM  {Product_Details} n WHERE n.Producttype
  = :db_condition_placeholder_0; Array (
      [:db_condition_placeholder_0] => Irons )

If you look into it  Product type is changed to Producttype and also S.No. is changed to SNo

Anyone got the idea how to write the SQL Query when column names has spaces?


texts: Views change "Exclude from display" at run-time

texts:
Main question: How to change the value for "Exclude from display" on runtime, programmatically ?

Background:
I am rendering a View programmatically.
The View has attached Data Export to it (exporting to CSV)
The view has multiple fields (42 actually).

On some action (hook_node_update, etc.), I load a node object.
The node object has 2 fields of interest.

field_views_filter = field that is using the Field Embed Views module
and stores
exposed filter settings
field_export_select_fields = list(text) field    that selects which
of those 42 fields should be exported to csv. Sometimes all fields will need to be displayed, sometimes only 5 fields will have to be displayed.

Scenario:
What I have tried:

<?php
function test () {
      // Loading arbitrary node
      $node = node_load(44165);

      $select_fields = array();

      $displayed_fields = array();
      foreach ($node->field_export_select_fields[LANGUAGE_NONE] as $key => $value) {
        $select_fields[] = $value['value'];
      }

      $name = 'MY_VIEW_NAME';
      $display = 'views_data_export_1';
      $view = views_get_view($name);
      $view->set_display($display);

      // Gets the exposed filters.
      $exposed_filters = $node->field_views_filter[LANGUAGE_NONE][0]['settings'];
      $view->set_exposed_input($exposed_filters);

      foreach ($view->display['views_data_export_1']->display_options['fields'] as $key_field => $value_field) {
        // This sets the value of "Exclude field from display to 1", but it is not working.
        $view->display['views_data_export_1']->display_options['fields'][$key_field]['exclude'] = 1;
      }
      $view->display['views_data_export_1']->display_options['fields']['title']['exclude'] = 0;

      $output = $view->preview();

      $file_string = 'sites/default/files/private/' . time() . '.xls';
      file_unmanaged_save_data($output, $file_string, FILE_EXISTS_REPLACE);

      $view->destroy();
    }


texts: Pros and cons of exposed filters versus contextual filters

texts:
I need to do some complicated filtering on my View and it seems that contextual filters lack the operators (e.g. between, greater than) available within the exposed filter configuration.  However, I don't want to user to be able to see or amend any filter widgets.

I can achieve this by setting the exposed filters to appear as a block and NOT assigning the block to the page.  I can then invoke the View by constructing a path with whatever querystring I wish and the filters are applied appropriately (e.g. www.mywebsite.com/myview?field_range=10&field_color=red).

Is there anything inherently wrong with this approach to using views, or any disadvantages?


texts: security report there is no .htaccess file in private:// directory

texts:
I have this security report  that is constantly saying:

  Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your private:// directory which contains the following lines:

Deny from all

#Turn off all options we don't need.
Options None
Options +FollowSymLinks

#Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006

<Files *>
  #Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

I have this exact file in sites/all/default/files/private. what could be wrong?
The private folder has the permissions set to 644.


texts: Exposed filters in views with Ajax turned on doesn't generate url

texts:
When using an exposed filter in a view while turning on Ajax doesn't generate a unique url.

Page with Ajax off

  nl/finder?product%5B284%5D=284&industry%5B269%5D=269&country%5B288%5D=288&country%5B290%5D=290

Page with Ajax on

  nl/finder#

Is this normal behavior of drupal or is there some setting i'm missing? I need to link to the page with some filters preset.


texts:
I created a Superfish menu in a test installation of Drupal (8.5.4) and want to import it into another install (8.5.5).  How can I do this?

Is the navigation data stored in menu_link, menu_link_content, and menu_tree?  I tried importing these tables into my new install, but when I try to "Place Block" in Block Layout - I don't see the old menu showing up as a Superfish block.

I also tried using the Menu Export module. But was unable to find the "Menu Export Configuration" page that they show in the image.

The new install is migrated from Drupal 7. So it lacks a config table.  Where is the config installed?  I think I need to copy the menu which is stored in a blob in the config table, but I don't know where to put it.

Note: The main question is "How can I export the menu"? To which the answer appears to be "Not possible." I'm still confused though as the menu information has to be stored somewhere. The other sub-questions are trying to get at pieces of the puzzle.


texts: How to create a list of the images in a folder with the nodes refering to them?

texts:
I would like to cleanup the folder sites/default/files by removing all images that belonged to a node that already has been deleted. Or would deleting a node, also delete the images it is showing in the body?

So, how can I know which images are no longer in use? Is there a tool to show which nodes are linking to the images? or to show images that are not linked to from anywhere in the site?


texts:
In Drupal 7, on the home page /home, I have a list of News items in the left column, and want to click on one of the News items in the list, and have the full article for that item show in the right column of the page.

Is there a way to pass an argument that doesn't change the page, like /home?xxx=arg   Everything I read talks about passing arguments in ways that change the page path (i.e., home/news1, or home/news2).


texts: Auto remove uber cart product attributes's option

texts:
Module:
https://www.drupal.org/project/ubercart

Scenario:
Product A: (has three options)
- blue (Expire in May) (It has node to describe more about this option)
- green (Expire in May) (It has node to describe more about this option)
- red (Expire in June) (It has node to describe more about this option)

Currently I use Scheduler module to auto remove the node once its expire, but unable to remove product attributes's option. As a result, I use rule to send me email once node had been remove.

Question: Can I use rule to remove product attribute's option or is there any other solution?

Many Thanks.


texts: Getting average of a numerical field across multiple nodes

texts:
I have a node type with a decimal field on it that saves percentages from 0-100%.

I want to get the average percentage from across all the nodes in that node type. So that no matter how many nodes are created under that node type, I can show the average on a landing page elsewhere using views.

Using drupal 8 and struggling to get this working.


texts:
We have several sites on a multisite structure, and almost all of them use Google CSE. However, some of these websites display the error "Refused to display 'http://www.google.com/cse?cx=...' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. This behaviour happens only for a couple of sites. I have compared Google CSE settings, and they are identical. How can I fix this issue?

UPDATE: I've compared directory sizes from both sites and they were different, so I've tried removing the module from the site that doesn't work, and copying one from a site that does work; but no dice :S


texts:
I am building a Church Management System, I am working on the members database at the moment. I have 2 contact types, Individual & Household.

The individual has fields for personal details & contact details one of which is a field for selecting which Household they belong to.
The Household has fields for the address of the household & contact details for the household.

When viewing the content for an Individual, I want to be able to click the listed Household which takes me to a page that shows me the details of the Household. e.g. Location, Contact Details & a list of the members of the household.

Is there a way to just put this into the Household Content type as a field, or how do I do this in Views?

I can set up the View to display the general details, but I cannot work out how to have it to show only the clicked household from the individual page and the individuals associated with the Household.

Thanks in advance.

Im still a bit confused I attempted pizzasynthesis suggestion and couldnt get it to work, and I have changed my thinking a bit. I am including screenshots of my config if anyone can give me ideas and/or suggestions on what to do would be awesome.

I am now thinking of using a block view that is only shown in the Household content type page and lists the Individuals of that Household(not sure it is possible to do but please tell me how best to do it).

Individual Content Type:

Test Member Edit Contact Details:

Household Content Type:

Household Edit Details:

Household Members View Block:

Individual:

Household:

I only want to be able to see the Individuals listed for that specific Household.

Any help would be greatly appreciated.

OK Heres where I am at now.

Block View:

Household:

Ive done what pizzasynthesis said and this is what Ive got.


texts: How to automatically add the permission "edit" on a node to a user who is not the author?

texts:
I'm in D6

I have a node type "Person" and a node type "Company"

Each node "Person" has :

an unique field-node-reference to a node "Company"
an unique field-user-reference (to a user)

So, several persons can belong to the same company

Use case :

The person P1.1 (belongs to company C1) creates a node (article)

How to automaticly grant edit permission on this article to an other person (P1.2) who belongs to the same company (C1) ?

Thank you


texts: views filter treats the zero in the same way as an empty field ( Drupal 8)

texts:
in a Drupal 8 installation I have a form ( webform ) in which numbers are entered ( they are tests of the water, like pH, KH etc.), these numbers are then made visible to the user through a view and the numbers entered are associated with the date.
So at the end a standard list comes out:
07/07/2020 | KH = 3
06/07/2020 | KH = 2
etc.
The problem I find is that when in the view I set a filter, like not null or (!= ) the fields in which zero is entered are treated in the same way as those that have been left empty, so the view displays everything and I come up with something like
07/07/2020 | KH = 3
06/07/2020 | KH = 2
05/07/2020 | KH = 0
04/07/2020 | KH =
In the previous example the last test of 04/07/2020 was not filled in but in the view the date and the empty Kh field appear anyway.
I tried to set as filter Kh NOT NULL or Kh (!= ), but the view treats me the zero in the same way as the empty field so the empty fields continue to appear in the list, while I would like to exclude them.  Do you have any idea? Thank you.
P.S.
another strange thing is that if I use a normal numeric field in a content type everything works, if I set a view and put as a filter for example Kh (!= ) all zeros are included in the list and fields left empty are excluded;If instead I use a numeric field from webform the zero and the empty fields are treated in the same way so if I exclude the empty fields also disappear those in which zero has been entered as a value.


texts: How to combine two nodes based on common title in Views?

texts:
I have a Commerce site selling clothing. Some Product Displays have multiple Commerce Products associated with them, and some have only one Product associated with them.

For example...

Shirt - Large - $10
Shirt - Medium - $8
Pants - One Size Fits All - $20

I need to use Views to display the title and price fields, as well as a link to the Product Display. I am using the Taxonomy term (Content) view with the Relationship "Content: Referenced products". I added the Title field, the "Size" field, and the "Commerce Product: Price" field, and enabled the "Distinct" setting in the Query Settings section. The result is as follows (fields are separated by a dash):

Shirt - Large - $10
Shirt - Medium - $8
Pants - One Size Fits All - $20

But I need the two "Shirt" items to be combined into a single line, like this:

Shirt - Large:$10 - Medium:$8
Pants - One Size Fits All - $20

Is it possible to combine products that have the same exact title (in this case, "Shirt")? There is only one Shirt product display page, on which the customer can choose Large or Medium.