texts: Browsing private and public files in IMCE

texts:
I have set up a public and a private file location (/admin/config/media/file-system).
The private file location is not under the Drupal directory ( it's /opt/private_files ).
I have set the "Default download method" to "Private local files served by Drupal."

I have configured a profile for IMCE ( /admin/config/media/imce ) called "User-1"
with a "Directory Path" of {root}/. "Including subdirectories".

I have assigned this profile to the role "administrator" under "Role-profile assignments" for both "PUBLIC FILES" as well as "PRIVATE FILES".

But when I access IMCE directly using mydomain.com/imce I only see the private files.

How can I switch or access the public files ?


texts: Get node ID or URL in Twig on field level

texts:
I have a field value, which I would like to link to the content (to the node itself, using it in a teaser).

How can I get the URL or at least the ID on field level, to create that link?


texts: Identical permission set for panels and panelizer with different results

texts: I have a brand new site install profile I'm working on and with a clean site install, I'm seeing different results of the same permission setting. We have roles "Site Editor" and "Site Admin" and for panels and panelizer, all permissions are set identically. However, Site Admin is seeing all Settings, Context, Layout, Content, and Breadcrumbs. Site Editor is seeing what should be seen: Layout and Content. I'm not sure if there is some other hidden permission that a Site Admin has that the Site Editor does not have that is causing this override.


texts: "Search Setting" missing from 'Search And MetaData' section on configuration page

texts:
I have a problem. I have a project that uses Domain Access.
I recently installed the "Search API" module and attempted to set up an indexing configuration.  That all went well, but when I tried to index the items I tried going to Drupal 'configuration' page, and under "Search And MetaData" section, there should be a link called "Search Settings", but there is not.

In a different project that did not use Domain Access I set this up and it works fine. Here is an example of the project that has search api set up properly and "Search Settings" shows up under "Search and Metadata"

I can click on "Search Settings" and it takes me to the "Search Settings" page where I can index my nodes, as well as a few other configuration options.

For my new project that uses Domain Access the "Search Settings" section is missing from "Search and Metadata", behold:

I initially thought it might be a permissions problem, and went to permissions section and the both have 'administrator' set under permissions for "administer search api".

Does anyone have any idea why my new project that uses Domain Access might be missing this page?  I tried going to the "Search Settings" page by manually typing the url into my browser, but it said "Access Denied". (I also have Access Denied backtrace set up and no reports were being generated after it gave me the access denied.

The only reason I mention that my new site uses Domain Access is because that is the only major difference between the 2 projects that I can see.

I would really love some help with this, and would consider it my Xmas present.  :D


texts: Ajax Callback only works after second click

texts:
I created a custom form with a textbox and a button. When the user clicks on that button, an ajax call should take place.
When I click on that button for the first time, a page refresh takes place. Only when I click on the button for the second time, my ajax-function is called.
I don't know what I'm doing wrong, so I would be greatful for any suggestion.

    $form['group_rrn']['actions'] = array(
        '#type' => 'button',
        '#value' => 'Ga verder',
        '#attributes' => array('class' => array('btn', 'btn-primary')),
        '#ajax' => [
            'callback' => '::ajaxRijksregisternummer',
            'event' => 'click',
            'wrapper' => 'aanvraag',
            'progress' => array(
                'type' => 'throbber',
                'message' => 'Even geduld',
            ),
        ],
    );

This is the CallBack function:
function ajaxRijksregisternummer($form, $form_state) {
    $response = new AjaxResponse();
    $rijksregisternummer = $form_state->getValue('rijksregisternummer');
    if(ReisdocumentenForm::isCorrectRijksregisternummer($rijksregisternummer)){
        $member = '';
        if(ReisdocumentenForm::isMemberApiCall($rijksregisternummer, $member)){
          $_SESSION['formpost'] = 'rrn_ok';
          $form['group_form']['email']['#required'] = TRUE;
          $response->addCommand(new CssCommand('#controle-rrn', ['display' => 'none']));
          $hasPartner = $member['hasPartner'];
          $federatie = $member['federation'];
          $partner = '';
          if($hasPartner == 'true'){
            $partner = $member['partnerInfo'];
          }
          $response->addCommand(new InvokeCommand(NULL, 'AjaxCallBackShowAanvraag', [$hasPartner, $partner, $federatie]));
        } else {
            $markup = '

Foutmelding
Dit formulier is enkel voor leden van ons ziekenfonds.

';
            $response->addCommand(new AppendCommand('#edit-foutmeldingen', $markup));
        }
    }
    else {
        $markup = '

Foutmelding
Geen correct rijksregisternummer.

';
        $response->addCommand(new AppendCommand('#edit-foutmeldingen', $markup));
    }
    return $response;
}

Kind regards!


texts: How to keep domain consistency (with or without www)?

texts:
Some search engines make a difference if the site is found in example.com or www.example.com. So it's important to redirect all users from example.com/some-page to www.example.com/some-page, or the other way around.

Is it possible in Drupal 7?


texts: Create a module to access a 3rd party API and store the keys in the database

texts:
I am new to Drupal module development, and have searched but haven't found any tutorials or guides on how to create a module to do the following:

Access a 3rd party API via a form
Store the user API key in the database
Access the API key when the user uses the 3rd party API via a form
    submission

Can someone show me how or point me in the right direction for at least steps 2 and 3?


texts:
I have a working GMAP view and I'd like to customize the markers basing on a list field.

I can't find documentations about this feature, in the settings of my view I setted

Marker Handling--> Use marker field

and

Field --> "myfield"

What I'd like to know is: does "myfield" has to be an image field or whatelse?


texts:
How can i make add to wishlist button with ajax like add to cart button using  Commerce ajax cart module .

Also in my view how to change the add to wishlist button text to already added if user has already added the product to wishlist.
I am using commerce wishlist module


texts: How to change image size and position when uploading to article in tb_rave_starter

texts:
I want to change image size and position
How could this be done, please help me.


texts:
I want to achieve the following query using db_select():

SELECT
  Column1,
  Column2,
  COALESCE(Column1, Column2) AS Column3
FROM TEST_ATTRIBUTES

How do I add the coalesced column to the query?

Thank you


texts: How to redirect user after submitting an article?

texts:
In Drupal 8 I would like to redirect users to the frontpage and display a status message after submitting an article?

How can I do that? form_alter and custom submit handler?


texts:
https://drushcommands.com/drush-9x/cache/cache:clear/ this doesn't give any option to clear all caches. All you get is to choose from 0-7, old drush cc all or cr all are gone.

Eg.

root@dev:/var/www/example.com/htdocs# drush cc --cache-clear

 Choose a cache to clear:
  [0] Cancel
  [1] drush
  [2] theme-registry
  [3] router
  [4] css-js
  [5] render
  [6] plugin
  [7] bin
  [8] views
 > 7

 [success] 'bin' cache was cleared.

How to clear all options below with one command? I can't find it documented.


texts: How to theme a radio button field on node edit form?

texts:
The standard way the radio buttons field is rendered on a node add/edit form is that there is a wrapper div with classes:

form-item form-type-radio form-item-mymodule-imglayout-und

and inside there are input and label elements. Where to hook to change this? I would like the wrapper div to have classes:

form-item form-type-radio form-item-mymodule-imglayout-und mycustomclass

And the custom class should be dependent on the option the button represents, or just be sequential: first, second, third, ...etc

Additional info:

My point is to be able to add a distinct big background image to each radio button, depending on the option it represents. Like below - note that each radio button has an associated image, representing its option visually.


texts: What function do I need to use for adding the image in the admin menu?


texts:
I read the other similar questions, but it didn't work.

I created a block in a region and I want to display that same block on my custom page (inside the twig).

I'm using this code to load the block:

$block = \Drupal::entityTypeManager()->getStorage('block')->load('block_id');
$block_content =  \Drupal::entityTypeManager()->getViewBuilder('block')->view($block);

and I'm trying to build it like this:

$build['page'] = array(
      '#type' => 'inline_template',
      '#template' => $template,
      '#form' => $block_content,
);
return $build;

My twig file is like this:

{{ form }}

But nothing is displayed...
What am I doing wrong?

Thanks in advance.


texts: Create a drupal 6 views slideshow from a single content type that has both, image and video fields

texts: I need a little direction. I've created a content type that has both, images and videos attached to a node. I need to create a single frame slideshow that riffles through the mixed media. Currently, I'm using the Embedded Media Field as well as the ImageField to upload the content. I'd like to keep that within the same content type if possible. For the most part, the slideshow is working, yet it displays both fields together.  I want a single slide per media type.  I've excluded one type, but adding the field programmatically has been a little challenging.


texts:
I've installed a drupal commons site (7.x-3.23).
I'm trying to give ability to choose on group creation if the group content will be visible or not from non-members of the group.
So i've activated organic group access control, rebuilt permissions, added in OG the field 'group content visibility' to the commons group bundle.
When i go to the group content type i see the field so it must be OK.
But when i create or edit a group, i never see the option for privacy content.
I opened the fields settings in group content type for the content visibility, and all seems fine in spite of the default value which is not displayed.

Can you help me?


texts: Custom theme function for language switcher block

texts:
I have a problem with theme hook suggestion for language switcher block.
I just need to place theme_links__locale_block() in MYMODULE.module file

My module:

/**
 * Implements hook_theme()
 */
function MYMODULE_theme() {
  return array(
    'MYMODULE_links' => array(
        'variables' => array(
            'links'      => NULL,
            'attributes' => NULL,
            'heading'    => NULL
        )
    )
  );
}

/**
 * It doesn't work...
 */
function theme_MYMODULE__locale_block(&$variables) {
    // custom function code ...
}

It works in my template.php file:

function MYTHEME_links__locale_block(&$variables) {
    // custom function code ...
}

I don't want to leave it in template.php because it is a part of my module.

Any help would be appreciated.


texts: Creating a node programmatically for a user who doesn't have the permission to create nodes of that content type

texts:
Let's say user X does not have the permission to create nodes of the content type Y, but the user does something which triggers an action, and this action is supposed to create a node of type Y. Will this be possible?

I want to do this because I don't want the user to manually create content as he could mess things up; I'd rather have this automatically done, hence the user not having permissions to create this type of node.

I'm using Drupal 6.


texts: VotingApi / Fivestar rating Player per Game

texts:
Can not figure how this works, and hope is doable.

I'd like to add a feature using the fivestar module but I could not figure it out myself. The work may simply require configuring the module correctly or make code changes.

I create a new node with "game" content type for each game.
I add the team squad (list of players) for that game. Each player is a separate node, with "player" content type.
I would like each player to be voted per game and display the score of the player for that game only. This is where I'm stuck, I could not display player votes per game.

Thanks


texts: Install module Snowball Stemmer with composer and required library

texts:
I need a german Stemmer processor for my Search API in Drupal 8. Snowball Stemmer seems to be the right choice, but I can't get it to work. Snowball Stemmer requires a library. I think it is the wamania/php-stemmer.
It should be installed with composer but I am not familiar with composer.
I tried following:
composer require drupal/snowball_stemmer

But I am getting
 [InvalidArgumentException]
 Could not find package drupal/snowball_stemmer at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

I tried also:
composer require drupal/snowball_stemmer --dev --ignore-platform-reqs

but getting the same error.
How I can install Snowball Stemmer with a german library?


texts: Automatic creation of Product Display for Drupal commerce?

texts:
Is there any way to automatically create a Product Display when I create a Product with the commerce module. The product display should references the product.

I'm thinking of using rules to accomplish this but not sure.

My client finds it complicated to create a product and then a product display.

Should I go with Ubercart module to accomplish this?


texts: load node author uid to be used as contextual link inside template.php D7

texts:
I need to load node author uid to be used as part of a href link inside template.php, I managed to add a contextual link according to this post, and call it from node.tpl.php but I can't access node author uid to complete my link. I have a view with the following path: /userview/%/post, link inside node.tpl.php it appears, but does not work. I tried to do it by custom module, but I do not know how to load the 'node being viewed' in a custom module, that's why I'm trying to do it in template.php. Any help will be appreciated.

This is my code in template.php

function MYTHEME_node_view_alter(&$build) {

         $node_author = user_load($node->uid);

          // Add your own custom link
          $build['links']['node']['#links']['user-post'] = array(
            'title' => t('User post'),
            'href' => '/userview/' . $node_author . '/post',
            'html' => TRUE,
            'attributes' => array(
              'title' => 'User post',
            ),
          );

        }


texts:
My Q is equal as Remove link from active page in menu

  I need the active page in my menu not to be a link.

  So let's say I'm on the services page, I need my menu structure to
  look like this:

home

services

portfolio

contact

How can I do that in drupal 8?

Update
what about this thing in my theme menu--main.html.twig?

{% if item.attributes.hasClass('active') %}
{{ item.title }}
{%- else -%}
{{ link(item.title, item.url) }}
{%- endif -%}


texts:
I have a view with some fields wich I theme inside views-view-fields--MYVIEW.tpl.php. I use a phptemplate_preprocess_views_view_unformatted__MYVIEW() to preprocess some $vars before the template to have the template as clean as possible. But I don't know the right way of preprocessing the fields.

I can access the fieldcontent in the template via $fields['MYFIELD']->content. Inside the preprocess function I can't find this explicit content value. All I see is something called last_render but i'm not sure it's ok (the right way) to use/change this value.


texts: Drupal 6 - Get 5 newest nodes of a certain type

texts: I have a content type called "announcements". They each have a title and field for the announcement. I'd like to be able to, in my .module, get the last five announcements and print out their contents to the page. How can I do this?


texts: How to create a table in a node form and extract certain data/fields?

texts:
I have a node type called Statistics. I then would like to create a Statistics node called package 1 which will hold data similar to below.

Contributor Level
Points needed | Level
1             | Beginner
5             | Intermediate
10            | Expert

Participator Level
Points needed | Level
1             | Beginner
15            | Intermediate
25            | Expert

I would then like to call the level of fetch the level based on points. So if it was an sql statement the query would be similar to.

$table = //fetch table based on criteria;
$points = //points based on users actions;
$level = 'select Level from $table where points = $points';
return $level;

However, I dont see a suitable way to create a table through the node create from on drupal, only through html. As a result I would have to create a php statement for each line on each table I create similar to

 if ( $points = 1 ) {
    return "beginner"
 } elseif ( $points > 1 & <= 5 )
    return "intermediate"
 } //etc

which will take a really long time.

So I was just wondering how I could essentially create a node field which can hold data which can be out put as a variable.


texts:
I have a custom site-wide block that shows on all pages, which I would like to be heavily cached for anon users but able to be invalidated when I modify its settings, or en/disable it (both drupal variables set in an admin page).

I've managed to achieve this pretty nicely in D8 with Cache::invalidateTags(), as well as some custom Acquia stuff to invalidate the varnish cache. However in trying to port this same functionality to a D7 site I've not managed to find any good method of doing it.

Any help much appreciated, thanks in advance!


texts: Check if field is empty in Views field Template

texts:
I have about 4 fields displayed in a view.

What I am looking to achieve is when one of the fields have a check box ticked, to hide a different field in the view display. e.g

Price on application [Ticked and displayed]

Price GBP [Hidden]

Price USD [Hidden]

OR

Price on application [Un-Ticked]

Price GBP [Dispalyed]

Price USD [Dispalyed]

I am editing the views-view-field.tpl for 'Price USD' and 'Price GBP' field.
(views-view-field--clone-of-gallery--gallery--field-listing-price-usd.tpl.php)

The basics I am trying to achieve are:

if 'price_on_application' = '1'
"Empty"
else
Print $output

The if statements i have tried so far are:

<?php if ($row->field_listing_price_on_request == "POA"): ?>
<?php if ($field->field_listing_price_on_request == '1'): ?>

and several other variations of the above.

Any ideas?


texts:
I have the following code:

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

  switch ($form_id) {
    case 'user_login_block':
    {
      unset($form['links']);

      $form['#action'] = '/user/login';
      $form['#submit'][] = 'custom_redirect';

      $form['actions']['submit2'] = array(
        '#type' => 'submit',
        '#value' => t('Sign Up')
      );

      //echo '<pre>';
      //print_r($form);
      //exit;

      break;
    }
  }

}

By all examples I have seen this should call a custom_redirect() in which I have tried echo'ing and exiting and using drupal_set_message('Form submitted'); to verify this callback is called.

It is not...I have refreshed the cache a dozen times...I had this working about 3 weeks ago and changed something...

Any ideas?


texts: How to send after filtered views result in mail in drupal 7?

texts:
I have created a view in drupal 7 with filters.. View is working fine I need to send after filter view result in mail with ajax views.
This time I am not using ajax so I am sending a filtered url in mail..
But I need to use ajax views. is it possible?


texts: Views taxonomy page with child terms only

texts:
i use this view configuration to get child terms from my taxonomy-vocabular.

i used the depth of 1. This give me the term id + its first child term content. But how i can get the child terms only?

Example:

Chef

--Subchef

----Child 1

----Child 2

When i click on Subchef it shows me Content from "Subchef" and from Child 1 and from Child 2. But i dont want to show the Subchef content. Any solution for this?


texts: What path should I give so that contextual filter works

texts:
I am creating on view page for which works like archive and I am doing it for the terms that are used in Blog(I am using blog module).

I have followed this tutorial.

But problem is when I give CONTEXTUAL FILTERS to year+month, and after that If I open my URL example.com/blog/201502 it is showing me 404 page.

Where am I lacking ?

NOTE: It is working fine in preview which are under view.

Some snap shot regarding this:

If I put path something like blog/% then It is showing me all the blog post and I want to have Terms.

If I click on January 2015 then It should give me following result :

Please help me.I have tried a lot.Let me know if more information is required.


texts: In Views, how to allow users to toggle between a grid and list?

texts:
I have a view that returns a 4 column grid view.  The client wants to be able to toggle between grid results and teaser results by clicking on an icon.

Does Views handle this naturally?  Do I need to utilize AJAX?


texts: D7 images not loading from css or from direct urls

texts:
I have a site that I have developed off-line and now loaded onto the production server.  None of the images load on the server (despite being present in the appropriate directories).  This applies to images loaded by css (for example:

.section-contact div#header {
background-image: url('/www.bernwodebenefice.com/images/contact_banner.png');}

It also applies to direct links from nodes.  For example:

<img alt="" src="/www.bernwodebenefice.com/sites/default/files/StMaryDedication_1_20121202.jpg" style="width: 220px; height: 322px; margin-left: auto; margin-right: auto;">

(these samples are from the rendered code and are what I expected).

I do not have this problem with any of my other sites running on the same host.  For example:

div#header {background-image: url(/sites/all/themes/Endurance80/css/images/e80_2013.gif); height: 263px; }

This works perfectly.  And urls within the site work nicely using the same sort of link addresses.

I guess I have got some parameter somewhere not set right...  (I copied .htaccess and php.ini from a working site to the failing site in the hopes it was a rewrite problem... nope)

Any thoughts?

Peter


texts: I am writing a view that lists all content of a specific type. I would like to, additionally, be able to set paths to content made by a specific user. For example drupal.dd/content will give all content. Then drupal.dd/%/content will show only the content by a specific user where % is the user's name. The issue I have come across is, when I create the path with /%/content it says the first segment of the path cannot be %. I am using a contextual filter to filter by author. How would I go about doing so. I am using Drupal 8.


texts: Question regarding rendering fields in node.tpl.php

texts:
I'm confused in how the fields can be rendered.
There are 2 variables in node.tpl.php $node and $content, both of which contain fields.
My task was to render all fields separately, to surround them with custom html. First I've tried

print render($content['field_service_summary'])

and got

array(1) { [0]=> array(1) { ["#markup"]=> string(11) "Engineering" } } Engineering

in result.

Trying to get rid of that array, I've taken another approach so the code became:

$field = field_get_items('node', $node, 'field_service_summary');
$output = field_view_value('node', $node, 'field_service_summary', $field[0]);
print render($output);

which actually worked, so, to clear this out I have following questions:

1) Where did that array come from when doing print render(content['field_service_engineering']); and how can I get rid of it(I still like this rendering approach better cause it's just shorter) ?

2) Is the second method I've used totally good, with no drawbacks ?

3) What's the point in keeping fields info both in $content and $node especially regarding that in vanilla node.tpl.php only $content is used for rendering fields ?

4) Just my curiosity: in $content array every field has value #object which seems to contain the node object itself. What is it for ?


texts:
I'm using webforms on Drupal 8.5.1 . I want to add some custom, arbitrary text to the form, so I chose to add a markup element. We want to have the text at the top of the form "Thank you for taking the time to fill out this survey. In order to serve you better..."

When the dialogue comes up, I see this:

From appearance and clicking, it seems like there is a missing textarea on the widget where I would enter the markup, right under the header "HTML markup".

I'm not sure if this is a problem with my install, my settings, or perhaps a bug.

I've looked at permissions and administrators have all webform permissions checked, and they are greyed out, so they can't be unselected. The account I'm using is an administrator account.

I am new to Drupal 8, and even more so its webforms. Is there something wrong in my settings?


texts: How I get the name of the taxonomy term reference of the content type

texts:
I created a content type. One of the field of the content type is entity term reference. Now I want to fetch the term of the particular content type and load the nodes that contain the term.I used the following code. But does not get the answer. Any error in my concept?

$aupl_node_query = new EntityFieldQuery();
$aupl_referrence = $aupl_node_query
->entityCondition('entity_type',  'taxonomy_term')
->execute();
dpm($aupl_referrence);
$aupl_node = node_load_multiple(array(), $aupl_referrence, true);


texts: Content field list(text) : using correctly ?

texts:
I have a little problem concerning the following :

For a specific content type, I've created a field of type "List(text)", which represents the difficulty of the content ; so in the values I've entered (I want to attach an icon to each value of that list) :

easy| Padawan

middle| Jedi

hard| Jedi Master

I've checked that the image path is correct, but the images don't appear anywhere...!

Thanks for reading ! :)


texts: Site re-directs to login page even after a successfull login

texts:
Presently I am using the Windows Server on which the drupal 7.34 is installed with the xampp server.

The url for the site is localhost:8081/example

When I enter the URL(localohost:8081/example) to login, the page simply re-directs to the login page

Whereas when I enter the complete URL (the IP address along with the port number it loads the site)

Now I can't figure out why the page is redirecting me to the login page but not the main page when I am entering the localhost:portno/example

[update]

Things Tried:-

1.Pinged the IP address and it was successful with no loss.

2.Tried it on a different browser Internet explorer got Error HTTP Error 403 Forbidden.

3.Tried on a different system with the same IP address and in that system the site loads fine.

Re-installed the drupal software again with the same localhost:portno/


texts: Redirect with POST and parameters in a controller

texts:
I want to redirect to a url (Sermepa/Redsys) with POST and some form parameters in a Controller. The process is I submit a form that collect some data, and when the user submit this form, it redirect to my controller. In this controller I prepare the post data and then I want to redirect to bank gateway with POST.
<?php

namespace Drupal\mymodule_sermepa_redsys\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\mymodule_sermepa_redsys\RedsysAPI;
use Drupal\node\NodeInterface;

/**
 * Class DoPaymentController.
 */
class DoPaymentController extends ControllerBase {

  public function doPayment(NodeInterface $node = null) {

    if ($node!==null) {

      $redsys = new RedsysAPI();
      $config = \Drupal::config('sermepa_redsys.settings');

      // Completamos los datos para la petición
      $redsys->setParameter("DS_MERCHANT_AMOUNT", $config->get('ammount'));
      $redsys->setParameter("DS_MERCHANT_ORDER", $node->id());
      $redsys->setParameter("DS_MERCHANT_MERCHANTCODE", $config->get('merchant_code'));
      $redsys->setParameter("DS_MERCHANT_CURRENCY", $config->get('currency'));
      $redsys->setParameter("DS_MERCHANT_TRANSACTIONTYPE", $config->get('transaction_type'));
      $redsys->setParameter("DS_MERCHANT_TERMINAL", $config->get('terminal'));
      $redsys->setParameter("DS_MERCHANT_MERCHANTURL", $config->get('url'));
      $redsys->setParameter("DS_MERCHANT_URLOK", $config->get('merchant_url_ok'));
      $redsys->setParameter("DS_MERCHANT_URLKO", $config->get('merchant_url_ko'));

      $version= $config->get('version');
      $kc = $config->get('merchant_password');

      $params = $redsys->createMerchantParameters();
      $signature = $redsys->createMerchantSignature($kc);

      $post_data['Ds_SignatureVersion'] = $version;
      $post_data['Ds_MerchantParameters'] = $params;
      $post_data['Ds_Signature'] = $signature;

      $client = \Drupal::httpClient();
      $response = $client->request('POST', $config->get('url_webservice'), ['form_params' => $post_data]);
      return $response;

    }
    else {
      return [
        '#markup' => t('Error. No nid'),
      ];
    }
  }
}

What I expected is after sumbit the form, controller was called, and then the user was redirected to bank payment page.
The form is a "create node" of a custom content type. In my .module file I have added a custom submit:
function mymodule_form_node_mycustomtype_form_alter(&$form, FormStateInterface &$form_state) {
...
$form['actions']['submit']['#submit'][]  = '_mycustom_form_submit';
}

function _mycustom_form_submit(array &$form, FormStateInterface $form_state) {
    $url = Url::fromRoute('mymodule_sermepa_redsys.payment_controller_doPayment');
    $url->setRouteParameters(array('node' => $form_state->getValue('nid')));
    $form_state->setRedirectUrl($url);
}

My routing file:
mymodule_sermepa_redsys.payment_controller_doPayment:
  path: '/doPayment/{node}'
  defaults:
    _controller: '\Drupal\mymodule_sermepa_redsys\Controller\DoPaymentController::doPayment'
    _title: 'Do Payment'
  requirements:
    _permission: 'access content'

Note: The class RedsysAPI is a helper class to prepare the data to POST, but It's irrelevant in the context of this question.


texts: Use a form to filter table data in a module

texts:
I have made a module in Drupal 6 that builds a page that shows some data taken from an external database.
I want to add a form that let the user filter the data (for example, limit the data output to a specific city instead all the cities).
How can I get the value of the submitted form and use it as a filter condition on the page rendering function? The $form_state variable doe not exist when running the page function and I have no way to load the value.


texts: Function to get all the user permissions

texts:
Is there a Drupal 7 function that lists all the user permissions defined from enabled modules?

What I need for a module I am implementing is getting all the permissions and adding to each one a checkbox list.

Is it possible to make the value of the checkbox the same shown in the "permission" column of the "role_permission" table?


texts: How to access current langcode in theme?

texts:
I use Integrity theme and want to make the slider images i18n aware.

I want to get the current langcode in the

function _integrity_get_home_block_contents

Previously it worked like this:

   global $language;
   $lang_id = $language->language;

What do I do now?


texts: Taxonomy breadcrumb on taxonony block in views (by contextual filters)

texts:
I have set up a block that shows up on the relevant pages that shows up other nodes with the same taxonomy terms (by means of contextual filters that take the argument from a given page).

Can I add a breadcrumb to the header of this block view? I have Crumbs installed.

Example Case:
This is a commerce site, and all the products are tagged by 2 vocabularies: "category" and "collection". Items that share a category tag are "internally similar" (say, all the apples), while "collection" tage are whose that the seller wants to present as similar (say, an apple and a specialized apple knife).
At the bottom of the product page are two blocks (views, contextual filters that take term argument from page) that display products that share both respective taxonomy terms with the main product on the page, and I want those to have a "taxonomy breadcrumb": not only a title with the (linked) tag  name, but also its parents (s).
I have actually  achieved that functionality by adding a views attachment to the block views.


texts: How can I link an image of a jCarousel to a certain link?

texts: I would like to link the different images of my jCarousel to different specific links depending on the actual image.


texts: Features along with configuration synchronization

texts:
I am planning to use features to bundle some of my specific works. Example: I want to bundle article content types along with its views, fields and related other stuffs. Can I just use features to create new article module through features ui and use it? How would it behaves when there is already configuration related to article in my sync folder which contains entire site configuration? Does anyone has experience on working with both of them simultaneously?

Thanks,

CIsSharp


texts: Node PHP function causing CRON not to run properly

texts:
Below is my code. I have two fields.

By default, "$staticPath" equals the path of the "field_static_ad" field, and "$flashPath" equals the path of the "field_flash_ad" field.

However, when there is nothing uploaded to "field_flash_ad", I want "$flashPath" to equal the path of "field_static_ad" instead.

This code WORKS for me know, but something is going wrong when I run CRON! I don't get an error, but I can't index my site.

<?php
if ($node = menu_get_object()) {  $nid = $node->nid; }

$staticPath = file_create_url($node->field_static_ad['und'][0]['uri']);

$flashPath = field_get_items('node', $node, 'field_flash_ad');

if ($flashPath) { $flashPath = file_create_url($node->field_flash_ad['und'][0]['uri']); }

else { $flashPath = file_create_url($node->field_static_ad['und'][0]['uri']); }
?>

Is there something wrong with my php?


texts: How can I restrict a filter plugin to certain entity types?

texts:
I have created a Filter Plugin which extends FilterBase and need to restrict it to certain entities, for example nodes and not comments.
How can I apply this condition?
I tried adding a context in the annotations, but it doesn't help.
/**
 * @Filter(
 *   id = "filter_ls",
 *   title = @Translation("Ls"),
 *   description = @Translation("Mark Ls"),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_MARKUP_LANGUAGE,
 *   context = {
 *     "node" = @ContextDefinition("entity:node", label = @Translation("Node"), required = TRUE),
 *   }
 * )
 */

I also tried to see ContextAwarePluginTrait, but it needs the class to be abstract.


texts: Send different email response based on form options?

texts: I need to set up a Request Download form in which users choose which software they want from a drop-down. Is there any way to make it, so they are sent a unique email for each software? If not, is there a way to just show different responses on form submit?


texts: Overwrite menu.twig only for specific node types

texts:
I've worked with twig and have overriden most of elements in my application. However, I it is not clear to me how I can overwrite the menu template for specific node-types. The suggestions I get from the theming debug are too general and not node  specific.
Any ideas on how to register a twig template for menu for specific node types?


texts: How to send send an image inside html email using swiftmailer?

texts:
in my Drupal 8 installation I'm using mailsystem module in combination with swiftmailer module. Everything works fine so far, my swiftmailer twig template inside the templates folder of my custom theme is recognized and works as it should in general.
Problem:
When I want to embed a logo inside my template (as inline image), the image can't be loaded. It renders the template and shows a broken image placeholder. I used the code mentioned in readme.txt (see point 3.2.2) of swiftmailer module:

Same error when I use

Logo path is generally working, use the same for my theme in general.
The image is embedded also inside the email (using MailHog to check it):
Content-Type: image/png; name=logo.png

Content-Transfer-Encoding: base64

Content-ID: <f8a965e25fc041c5af9318b9d71cd3d1@mysite.site>

Content-Disposition: inline; filename=logo.png

.... image code following ....

How can I get my logo image inside my email correctly?
Would like to avoid simply setting a linked image it to my webserver if possible,to minimize webserver traffic.
Thanks in advance :)


texts:
All blocks in the footer region use a CSS grid system. I want to add a <div> with CSS attributes to each (custom) block in the footer. The code I have will show the blocks in the footer, but will give an error. Changing {{ key }} to {{ key.content }} is not helping. I am using Drupal 8.6.8.

The code that I am using in the page.html.twig template is the following.

{% for key in page.footer %}
    <div class="col col-4">
        {{ key }}
    </div>
{% endfor %}

Using that code, I get this error message.

  User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of core\lib\Drupal\Core\Render\Element.php).


texts: How to suppress output of  tags in a views2 field output?

texts: I've determined that I have an extra blank line above/below a field as output by views2.  The generated html code examination shows a set of paragraph tags enclosing the field.  I can find nowhere within this view to suppress that output.  Is there a way either within views2 or via some css attribute?


texts: how to include .inc files in drupal8 in custom form

texts: I have my custom module in drupal8.I have created a custom form.My form has many fields so i was wanted to move it to .inc files.Please can someone suggest me how and where to include my .inc file.


texts: Token replacement pattern is not working

texts:
I am using Drupal 7, and I have a node reference field in my content type.
I used a token replacement pattern for auto-titling the node, but the token referring the node reference is not working. (The token is [node:field_package_name].)

Please help me.


texts: Drupal CKEditor module remove line breaks

texts:
I have legacy content that has line breaks as paragraph separator. When trying to deal with them using CKEditor module 7.x-1.16 and CKEditor 4.5.4 library, all line breaks  are removed and the text turned into an ugly mass of text.

I tried disabling some filters from the Full HTML input format:

Limit allowed HTML tags
Convert line breaks into HTML
Correct faulty and chopped off HTML

I also tried to use custom formatting options and disabling _Advanced content filter. In any case, I didn't achieve my purpose.


texts: Seeking an approach to maintain a drupal site from a mobile platform

texts:
I have a client who needs to update their drupal site almost exclusively from their iPhone and iPad. They need to be able to upload images from iOS Photos. I have some ideas on how to approach, but I'm wondering if anybody in the community has encountered this situation and can suggest a combination of theme & modules that will help me get most of the way there.
thanks


texts: How to track and display selected user activities in a site?

texts:
I wonder how to track and display user activities in a Drupal site. Examples of such activities are:

posts.
comments.
page posts.

I've found some modules that track the users' activites all over the social media, but I need something much more local (within the site).

I was also thinking about using Views to create a block with this kind of filters, but I have never seen filters as specific as users. Is there a way to achieve this?


texts: How to direct user to a custom path after executing a Views Bulk Operations action?

texts: I have created a custom action as described at https://www.drupal.org/node/2052067. My question is how to direct the user to a custom path after executing the action?


texts: Ubercart Marketplace - Where is the ImageField for users?

texts:
Using Drupal 6

The Imagefield is configured for products.  The imagefield appears for admin but not for users.  How do I get the imagefield to appear for users who are authorized Ubercart Marketplace sellers?  Any help is appreciated!

Andre E.


texts:
I want to add the attribute data-toggle="toggle" to a checkbox field.

I thought I could use the hook theme_checkbox which is:

function theme_checkbox($variables) {
  $element = $variables ['element'];
  $element ['#attributes']['type'] = 'checkbox';
  element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));

  // Unchecked checkbox has #value of integer 0.
  if (!empty($element ['#checked'])) {
    $element ['#attributes']['checked'] = 'checked';
  }
  _form_set_class($element, array('form-checkbox'));

  return '<input' . drupal_attributes($element ['#attributes']) . ' />';
}

So I customised it to:

function mytheme_checkbox($variables) {
  $element = $variables ['element'];
  $element ['#attributes']['type'] = 'checkbox';
  element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));

  // Unchecked checkbox has #value of integer 0.
  if (!empty($element ['#checked'])) {
    $element ['#attributes']['checked'] = 'checked';
  }

  //*******Added 3 lines below*******
  if ($element['#attributes']['id'] = 'edit-profile-carer-field-profile-active-und') {
      element_set_attributes($element, array('#attributes' => 'data-toggle="toggle"'));
  }

  _form_set_class($element, array('form-checkbox'));

  return '<input' . drupal_attributes($element ['#attributes']) . ' />';
}

However, instead of just adding the attribute data-toggle="toggle" to the checkbox field  with the id edit-profile-carer-field-profile-active-und, it is adding the attribute to all the checkboxes on the form.

Can someone tell me what I am doing wrong? How can I target just the the checkbox I want? Or do I need to use another approach to do it?


texts:
I'm trying to create a feature that includes an Automatic Nodetitle.

I want to change two things related to Automatic Nodetitle: Hide Title in content creation and populate the field with tokens.

How would I go about this?


texts: How to print custom form on a tab in user profile page?

texts:
My problem seems to be related with my theme function not being called.

$items['user/%/car/form'] = array(
        'title' => 'Car',
        'description' => 'Cars',
        'file' => 'car/cars.inc',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('car_form'),
        'access arguments' => array('car form'),
        'type' => MENU_LOCAL_TASK,
);

With this link to the same form, everything works correctly, theme function gets called.

$items['cars/car/form'] = array(
        'title' => 'Car',
        'description' => 'Cars',
        'file' => 'car/cars.inc',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('car_form'),
        'access arguments' => array('car form'),
    );

In the form array

$form['#theme'] = 'cars';

In the modules theme function

'cars' => array
        (
            'render element' => 'form'
        ),

Anyone knows how to print forms? I can print tables into user profile tabs, but with forms I just get an empty page.


texts: How can I remove Features modules from a site without affecting functionality?

texts:
I have inherited a site that makes heavy use of Features, and this constrains what I can do to permissions and creates dependencies that don't otherwise exist.  Something as simple as turning off the overlay becomes a mystery.

Is there some way I can remove these features and give back control to the database and to dependencies declared in non-Feature modules? I'd sure like to be able to adjust permissions by visiting the usual permissions UI and making the change as per usual.

I see there is a Features Tools module that appears relevant, but it does not seem to address things like roles and permissions.  And it's a bit discouraging to think that an additional module might be necessary just to de-Features a site.


texts: Using an address field widget on a custom form and storing data

texts:
I have a Subscription custom entity and I would like to use the default entity form for administration tasks and a custom multistep form for the subscription process.

I added an address field to my Subscription entity and I would like to use the widget in one of the custom form steps.

I was expecting I could use something like '#type' => 'widget_id' plus some widget configuration, but it does not seem to be so simple as this answer points out.

  a widget and a form element are two different things that are used in different cases; consider a widget a more specialized type of form element.

What would be the right approach then? In the field_attach_form change record a comment suggests

$display = EntityFormDisplay::collectRenderDisplay($entity, 'default');
$display->buildForm($entity, $form, $form_state);

How do I get just my address field? Form display modes?

And then, how do I deal with validating and storing the data properly?


texts: How to add having to entity query Drupal\Core\Entity\Query\Sql\Query

texts:
I need to alter the query in getEntityIds method in PathAliasListBuilder i need only to get only paths with multiple path system:

The sql select should be like:

SELECT *
FROM `path_alias`
GROUP BY `path`
HAVING COUNT(*) > 1

i manage to add group by:

$query->groupBy('path');

But i didn't find anyway to add HAVING COUNT(*) > 1

I have found this answer how to add having to Select but nothing how to Query?


texts: Cannot use fields as product attributes if they are within a field collection

texts:
I am building a commerce marketplace, and have several field that I am reusing on multiple product types. It's getting tedious adding them over and over, so I'd like to include them in a field collection.

The issue is that fields within a field collection cannot be marked as (and I'm paraphrasing) "should be used as a product attribute." I'm assuming this is because the fields do not know that they will be used on a commerce product, so the option isn't available.

Does anybody know of a way to implement this functionality? I'm open to coding, I just don't know what I'd work on.


texts: Create a user Programmatically in Drupal 6.22

texts:
i was trying to create a new user Programmatically in drupal 6.22 but i can't seem to get it working.
I need to make a web service that can do a few things, one being create a new user.
This webservice is going to be consumed by a mobile device.
I was just trying to test the user_save from outside drupal in just a simple php file and it doesn't seem to work. I just need to know what i'm doing wrong.

Here is my code

<?php
    require_once(includes/bootstrap.inc);
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    // Get an array of roles
    $roles = user_roles();
//Basic account information
$user = array(
    'name' => 'username',
    'pass' => 'Password',
    'mail' => 'email',
    'status' => 1,
   'init' => 'email',
    'roles' => array(array_search('authenticated user', $roles) => 1),
);
// See if the user exists by calling Drupal's user_load()
$existing_user = user_load(array('name' => $user['name']));
    if (!$existing_user->uid) {
    // Save the user
    $user = user_save(NULL, $user);
    }
?>

EDIT: Added the drupal_bootstrap, still not working for me.


texts: How to count the number of posts by a author?

texts:
I have created a view with table settings. I would like to display the name of the author and the total number of posts that he has created. I have used relations to get the author name but I don't see any fields related to count the number of posts.

Any suggestions?


texts: Book: Drupal 7 Module Development (directions caused weirdness)

texts:
I'm reading a book, Drupal 7 Module Development, and I'm hitting some very weird outputs.

I created a folder:

mysite/sites/default/module/first

Inside this folder I created two files.

first.info

;$Id$

name = First
description = A first module
package = Drupal 7 Development
core = 7.x
files[] = first.module

;dependencies[] = autoload
;php = 5.2

first.module

<?php

// $Id$

/**
 * @file
 * A module exmplifying Drupal coding practices and API's.
 *
 * This module provides a block that lists all of the
 * installed modules. It illustrates coding standards,
 * practices, and API use for Drupal 7.
 */

/**
 * Implements hook_help().
 */
function first_help($path, $arg) {
    if ($path == 'admin/help#first') {
        return t('A demonstration module.');
    }
}

But when I activate the module, I get the contents of the first.module file spashed across the top of my page? Can someone advise me on what I am doing wrong?

This is my very first module for Drupal.


texts:
I am looking to create an apointment scheduling system on drupal 7.x, however all of the modules and instructions that I can find are for 6.x. The system is fairly simple, and only needs to be able to have users schedule appointments for certain blocks of time.

How would I go about doing this in 7.x? Are there any modules that I can use, or is there some way to "hack" this out?


texts: Target EntityBrowser in custom validation constraint

texts:
Having a custom validation constraint on an entity reference field using entity browser as form widget, I am trying to get the field light up in the form on validation violation. This is not working for me.
Using the following code in an entity validation constraint:
      $this->context
        ->buildViolation($constraint->message, [])
        ->atPath('field_entity_reference')
        ->addViolation();

This works fine for fields that do not use the entity browser widget (the field gets marked red indicating an validation error). But for the entity browser widget the field is not marked in the form, though the validation itself is working correct. It seems to me this is related to the entity browser widget. There is this information about targeting specific properties in complex field widgets, which seems to address this matter. But I cannot seem to find a way to target the right property to make the field light up in the form. Entity Browser widget only have hidden form input elements and targeting does not seem to work on container or div fields as far as I can see, so maybe this is the reason this is not working?
Is there a possibility to have the entity browser widget light up in the form on validation violation?


texts: HOOK_menu_alter to remove Main Menu items for specific user roles

texts:
I'm trying to add a menu link (admin/people/create?operator=1) to the Main Menu only for the user role of 'Supervisor.'

I have tried to do this:

function mymodule_menu_alter(&$items) {

 if(in_array('Supervisor', array_values($user->roles)))
   $items['admin/people/create?operator=1']['type'] = {idk what goes here};

}

But I'm not sure I am on the right track.


texts: If a user does not have a role, keep redirecting them to the same form until they complete it?

texts:
I have a form/node that I want all users to complete after logging in for the first time.  When the user completes the form (saves the node), they are automatically awarded the completed role.

If a user does not have the completed role, I want to keep redirecting them to the form no matter what links they click.

In Drupal 7, I could do this with Rules (event: content is viewed, condition: user does not have role, action: redirect).  However, in Drupal 8, Rules is still in alpha and I can't get it to work without crashing my site.  So what hook should I use to do this programmatically? (what's the hook for "user views a node"?)


texts:
I'm creating a drupal website that will be maintained by others. To make it as simple as possible for them, I would like to automate as much as possible. Part of this is allowing them to add new webform questions without having to change the redirect URL (the answers will be processed in another node).

What I would like to do is catch ALL answers, regardless of the questions. So, it should work when there is one question or when there are 15 questions, without having to manually change the redirect parameters. Currently, I construct the URL manually by adding tokens for each question to the redirect URL.

I would prefer to use tokens in the webform's redirect URL. But I'm willing to write some code if it's the only way.

EDIT, extra info:

The node receiving the parameters has already been programmed to dynamically accept all arguments


texts: add content page doesnot work for other users

texts: I created a few users that are responsible for adding content to the website. they are just allowed to add/remove content (defined by role). the problem is the add content link (mywebsite/node/add) does not display the add page, it just displays MY page.tpl.php . I guess add page is overridden by my page.tpl.php , how can I have admin add page for other users ?


texts: how to change the message "you must be logged in to place an order." I can not find in the rules and in the translation? thank you


texts: Can I clear cache only for particular domain / URL?

texts:
I'm using domain module with several domains. With drush you can clear cache using cc command. I have only one database for all domains.

I'm wondering can I clear cache using only specific domain (with -l option) if I'm using same DB for all domains?

e.g: $ drush -l http://www.example.com cc all


texts:
I have an error in my Drupal 7 site when I try to install any module.

If I try the Install from a URL I get:

  HTTP error 0 occurred when trying to fetch http://ftp.drupal.org/files/projects/google_analytics-7.x-1.3.tar.gz.

  Unable to retrieve Drupal project from http://ftp.drupal.org/files/projects/google_analytics-7.x-1.3.tar.gz.

If I try Upload a module or theme archive to install I get:

  An AJAX HTTP request terminated abnormally. Debugging information follows. Path: StatusText: ResponseText: ReadyState: 4

The error page shows me:

  Notice: Undefined index: log in update_authorize_install_batch_finished() (line 235 of V:\www\site\modules\update\update.authorize.inc).
  Warning: Invalid argument supplied for foreach() in update_authorize_install_batch_finished() (line 235 of V:\www\site\modules\update\update.authorize.inc).
  Notice: Undefined index: log in update_authorize_install_batch_finished() (line 276 of V:\www\site\modules\update\update.authorize.inc).
  Notice: Undefined index: tasks in update_authorize_install_batch_finished() (line 277 of V:\www\site\modules\update\update.authorize.inc).
  Installation failed! See the log below for more information.

Any ideas on how I can troubleshoot this?


texts: Conditionally unpublish a nodes more than latest 20

texts:
I want to show the latest updated 20 nodes and unpublish rest of the nodes more than 20 for particular content types.

Here is my code I Have done for a single node

public function unpublishednode() {
   $all_content_types = NodeType::loadMultiple();
    foreach ($all_content_types as $machine_name => $content_type) {
      if($machine_name == 'events') {
        $node = Node::load(389);
        $node->setPublished(FALSE);
        $node->save();

      }
    }
}


texts:
Having a problem theming or changing the looks of my outgoing contact form e-mails.

I have followed this topic on the subject:
How can I theme the outgoing contact mail?

I have done all the points nicholas.alipaz mentions (except 7. since I don't need that).
I also have Berdirs code in my .theme and custom module. (yourmodule is of course replaced with the real theme name [is it supposed to be the module name for the custom module or the theme name??])

In .theme file:

/**
* Implements hook_entity_type_alter().
* @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_types
*/
function yourmodule_entity_type_alter(array &$entity_types) {
    $entity_types['contact_message']->setViewBuilderClass('Drupal\yourmoule\ContactMessageViewBuilder');
}

/**
* Implements hook_mail_alter().
*/
function yourmodule_mail_alter(&$message) {
    if ($message['module'] == 'contact' && isset($message['params']['contact_message'])) {
// Enforce that we are sending mails as HTML.
    $message['headers']['Content-Type'] = 'text/html';
}
}

In custom module:

namespace Drupal\yourmodule;

use Drupal\contact\MessageViewBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
* Customized contact message view that does not do HTML to plain conversion.
*/
class ContactMessageViewBuilder extends MessageViewBuilder {

/**
 * {@inheritdoc}
 */
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    $build = parent::view($entity, $view_mode, $langcode);
    // Remove the post render callback that converts the HTML to plain text.
    unset($build['#post_render']);
    return $build;
}
}

I selected one column view via display suite but the only thing that happened was

< data-quickedit-entity-id="contact_message/" class="view-mode-mail ds-1col clearfix">

was added to the e-mail after the "user sent message using contact form at" text. The email itself was in plaintext, not HTML.

I really am at a loss here, what to do and I couldn't comment, so I had to make a new topic about the same thing.


texts:
I've found a way to add a style to a region. The link is /admin/structure/ds/styles.

I've found a way to specify a style for my Title. We can choose the "class" attribute of  title property.

Howe can I add a specific class/span to my "publish date" field?

How can I do that with Display Suite?


texts: Which hooks should I implement in Drupal 7 that are the equivalent of hook_comment() and hook_nodeapi()?

texts:
This is the code I am using for Drupal 6:

/**
 * @Implement of hook_nodeapi()
 */
function mycaptcha_nodeapi(&$node, $op, $teaser, $page) {
  global $user;
  switch ($op) {
    case 'insert':
      if (isset($_SESSION['mycaptcha_ask_key'])) {
        unset($_SESSION['mycaptcha_ask_key']);
      }
    break;
    case 'validate':
      if ($node->mycaptcha_ask) {

        mycaptcha_ask_form_validate($node->mycaptcha_ask);
      }
    break;
  }
}

/**
 * @Implement of hook_comment()
 */
function mycaptcha_comment(&$comment, $op) {
  global $user;
  switch ($op) {
    case 'insert':
      if (isset($_SESSION['mycaptcha_ask_key'])) {
        unset($_SESSION['mycaptcha_ask_key']);
      }
    break;
    case 'validate':
      if ($comment['mycaptcha_ask']) {
        mycaptcha_ask_form_validate($comment['mycaptcha_ask']);
      }
    break;
  }
}

What are the equivalent hooks that I should implement for Drupal 7, to obtain code equivalent to the one I am actually using for Drupal 6?

from kiamlaluno's help. i changed the code to the following. but the validation still doesn't work. but the above code(hook_comment) works ok under drupal 6.

what's wrong with my code in drupal 7.

function mycaptcha_comment_insert($comment) {
  global $user;
      if (isset($_SESSION['mycaptcha_ask_key'])) {
        unset($_SESSION['mycaptcha_ask_key']);
      }
   }

function mycaptcha_form_comment_form_alter(&$form, &$form_state, $form_id) {
    global $user;
  $form['#validate'][] = 'mycaptcha_comment_validate';
}

function mycaptcha_comment_validate($form, &$form_state) {
    global $user;
      if ($comment['mycaptcha_ask']) {
        mycaptcha_ask_form_validate($comment['mycaptcha_ask']);
      }

  }


texts:
What's the equivalent of field_info_instance() for Drupal 8?

The default field settings are stored as configuration in a file like field.field.ENTITYTYPE.BUNDLE.FIELDNAME.yml, but how do I get their current value?


texts: How to allow anonymous comments on one content type, but not all

texts:
I would like anonymous visitors to be able to comment on my 'Blog' content type, but only registered users comment on my 'Forum' content type.

It seems that if anonymous users have permission to comment, this applies to all content types with commenting enabled.

Am I missing a setting somewhere, or would I need to look at hiding/disabling the comment form if content type is 'Forum' and user is anonymous?


texts: Set value for date field in hook_form_alter

texts:
How can I set the default date for a date field in hook_form_alter().?

I tried:

$form["field_price_date"]["und"][0]['value']['#default_value'] = $curDate;
$form["field_price_date"]["und"][0]['value']['date']['#default_value'] = $curDate;
$form["field_price_date"]["und"][0]['value']['date'] = $curDate;
$form["field_price_date"]["und"][0]['value'] = $curDate;

None of the above work.


texts:
When viewing a page, the page title is empty.
In page tpl, page title isn't printed

<?php print render($title_prefix); ?>
    <?php if ($title): ?>
    <?php if ($title_hidden): ?>
<?php endif; ?>

<?php print $title; ?></h>
    <?php if ($title_hidden): ?>
<?php endif; ?>
    <?php endif; ?>
<?php print render($title_suffix); ?>

Any help is appreciated!


texts: trigger in rules a beep sound on user side (current user is working)

texts:
I have a D7 site running with Organic groups, rules, VBO, panels, badges, private-message modules ... and a bootstrap sub-theme (js, jQuery update, ...) working in all browsers, ios & android, i need to alert users with a beep sound when new OG content is created (or any rules reaction) by a custom module named beepsound module.

What I have:

•   Rules event: create new content

•   Rules condition: my contentype with some fields.

•   Rules action: Loop: all OG group members, loop action: see code below

"beepsound module" must have UID variable to target a specific OG member.

I have manage to have my beepsound as an action in rules, it targets UID, it display a personalised message corectly, also, message is displayed 5 times (when tiggered when mycontentype is being viewed), meaning rule is triggered 5 times, here are my-module code files, dot module file exist but is empty (and not displayed here), If i run this rule with current-user, it works (makes a beep), but not in my OG loop, what it is wrong?

beepsound.info MODULE

name = Beep sound by rules module
description = Module to add a beep sound action in rules
package = Custom
version = 7.01
core = 7.x
dependencies[] = rules

beepsound.rules.inc MODULE

/**
* Implement hook_rules_action_info()
* Declare any meta data about actions for Rules
*/

function beepsound_rules_action_info() {
$actions = array(
'beepsound_action_beepsound_user' => array(
    'label' => t('Make a beep sound'),
    'group' => t('sound'),
    'parameter' => array(
        'account' => array(
            'type' => 'user',
            'label' => t('User to beep'),
            ),
    ),
  ),

);

  return $actions;
}

/**
 * The action function for produce sound
 */

function beepsound_action_beepsound_user($account) {
    drupal_set_message(t('Hello @username',
 array('@username' => $account->name)));
    ?><audio autoplay="autoplay">
      <source src="/sites/all/modules/beepsound/A-tone.ogg" type="audio/ogg">
      <source src="/sites/all/modules/beepsound/A-Tone.mp3" type="audio/mp3">
    </audio><?php
}

here is my rule

{ "og_og_new_content_notification_message" : {
"LABEL" : "OG new content notification message",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "OG" ],
"REQUIRES" : [ "og", "rules", "privatemsg_rules", "beepsound" ],
"ON" : { "node_insert" : [] },
"IF" : [ { "og_entity_is_group_content" : { "entity" : [ "node" ] } } ],
"DO" : [
  { "og_get_members" : {
      "USING" : { "group_content" : [ "node" ] },
      "PROVIDE" : { "group_members" : { "group_members" : "List of group members" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "group-members" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "privatemsg_rules_new" : {
            "USING" : {
              "recipient" : [ "list-item" ],
              "author" : [ "node:author" ],
              "subject" : "\u0022[node:title]\u0022 a sido creado. ",
              "body" : "\u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E Por favor haz clic aqu\u00ed para ver su contenido\u003C\/a\u003E"
            },
            "PROVIDE" : { "thread_id" : { "thread_id" : "ID of new thread" } }
          }
        },
        { "beepsound_action_beepsound_user" : { "account" : [ "list-item" ] } },
        { "drupal_message" : { "message" : "beep beep, usuario: \u0022[list-item:uid]\u0022" } }
      ]
    }
  },
  { "drupal_message" : { "message" : "Se ha enviado un mensaje a todos los miembros del departamento." } }
]

}
}


texts: how do i modify the paypal order details?

texts: My client logs into Paypal to review the orders that have been processed and would like to see the actual product name rather than the order number. How do I accomplish this?


texts:
I'm developing a custom theme using sub-theme just for learning purpose. In custom theme, I have added a custom block in which I need to display main menus' sub items if in_active_trail. I have already tried many times and wasted a lot time but unsuccessful.

Block should display when Level 1 is in_active_trails and it has child(s).
Block should not display when Level 1 in_active_trails but it has no child.
If any Level 2 is current page, display Level 2 and 3 menu items expect level 1.
Same as point 3, if Level 3 is current page then display level 3 and 2 items.

See attached image below for more understanding what I want to do.

Main Menu hierarchy


texts: How to fetch fields related to node in view templates?

texts:
Hi I am trying to do similar in Drupal 8 :

Can we write php conditions in view field templates?

Is that possible to fetch fields related to node such as terms, comments count and comment form link, revisions, voting count and voting widget and edit link in one field template. If I create template file of title field like How can we override view field template in drupal 8  and need to fetch other fields related to node in that same template, But we should not add other fields in view itself but fetch other fields related to node in preprocess or by some other method.

Please suggest, I am trying but not able to conclude exact approach.

File made template based on above which is in action for title field everywhere :

  views-view-field--title.html.twig

Is that possible to fetch other fields related to node in this template without adding fields in view ?

Thanks!


texts: How do I create a variable to check last time hook_cron() implemented from a custom module was ran?

texts:
We have a custom module for which we need to run on a daily basis. I am not sure  it is working, as I am unable to store the time correctly.

Does the following code allow me to create a variable, and use it to store the last time cron ran?

function mymodule_cron() {
  if (variable_get('mymodule_last_run', 0) <= strtotime('-1 day')) {
    // Omissis.
    variable_set('mymodule_last_run', time());
  }
}

function mymodule_info($options) {
  $variable['mymodule_last_run'] = array(
    'title' => t('Last Run', array(), $options),
    'type' => 'datetime',
    'default' => t(time(), array(), $options),
  );
}


texts: Double values (products) in Commerce cart form

texts:
I use Drupal Commerce version 8.x-2.15. I have a multilingual Drupal site with multiple languages based on domain.

mystic.com -> EN language
mystic.eu -> NL language

etc

I added relationships:

(order_items: Order item) Product variation
(Product variation) Product

To get the image_field available to show a thumbnail in my cart form. This works fine.

After I added those relationships and I add one product to my shopping cart and I see now the number of times that I translated my product back in the shopping cart, like:
My product
My product
My product
My product

(so above product is translated into 4 languages).

I've fixed this by adding a filter to the view:

Product: Translation language Is one of Content language selected for page

It looks like this is working but I see now 2 values (see screenshot)

It doubled the added product. But the price and quantity shows 1.


texts:
When you write a module, you write unit tests (or you should - I don't because I am a bad person, but I want to change - honest).

Should modules generated with Features be unit tested where applicable/possible, or is a suite of Selenium tests enough?

For example, say I have a Feature that has a node type and a couple of user roles and/or permissions for said content type.  Is it good practice (or even necessary) for SimpleTests to be written to test creation of my content type?

For clarity, I am aware of Unit test for custom content type, but I am after an answer regarding all unit testable functionality, not just content types.


texts: How can i convert country iso code to country name while creating a node programatically using node_save? I am creating nodes programatically by fetching contents from secondary database of drupal. When i do this way, am getting country iso code in the country field instead want the name of the country. How can i achieve this?


texts: How to display a custom block as a pop on home page?

texts: I have a custom block created, it contains 3 links in it. Now I want to display that block as a popup on home page. I looked at the Popup module but it didn't work.


texts: View only content created by that particular user

texts:
I want the user to view only the content created by him.

Used "content access module". And change permissions for the user to "Grant own Content Access".

But other users also able to see the content created by other users.
Below is my permissions page:

Not able to find what went wrong.
Please correct me.

If any other module is there please suggest me.


texts: add a field to registeration to subscribe to newsletter module

texts:
I want something like the enewsletter module (it is for Drupal 6) for Drupal 7.

I used simplenews module, it add a subscribing field to user registration and it is well, but my problem is that in registration user select with category(from favourites taxonomy) want to be subscribe, and in creating simplenews content type select the term that this email send to them,( send simplenews content type according to taxonomy terms ).

I found simplenews terms module but it is for Drupal 6.

I try newsletters module but it is very complex and doesn't provide something I want.


texts: Why aren't my variables passed to my template?

texts:
I have a custom module that run this code in the my_module.module file

function my_module_theme($existing, $type, $theme, $path) {
  return array(
    'block__my_template' => array(
      'template' => 'block--my-template',
      'variables' => array(
        'node_id' => \Drupal::routeMatch()->getParameter('node')->id(),
      )
    )
  );
}

I am trying to pass the current node id to the template but the value is null. If I do a var_dump(\Drupal::routeMatch()->getParameter('node')->id()) it prints out the current node id so the function works.

My template does this:

Node Id: {{ node_id }}

Why aren't my variables passed to the template? What am I missing?


texts:
Is it possible to copy (clone) regions (or at least blocks) with their settings from one panel to another panel?
I have two different panel pages, but some of the regions are the same in both panels. Could I just set such common regions once and then "copy" them to another panel?

thanks for advice
Tomas


texts: Is there a module that allows users to post content in steps?

texts:
sometimes posting a blog post can seem daunting to some of my users. They see a large page with so many entry points that I think I'm missing out on some good content. So what I would like to do is give users the ability to add entries in steps. without seeing the entire form.

Title
body
tags
video


texts:
I am trying to add an Image as Custom field in Civicrm Contact, but the Image Field type is not in the Custom Field section. It has only Field type as File.

How to apply Drupal Image styles for Images uploaded on Civicrm Contact.

I have integrated Civicrm in Drupal 7.


texts:
I've lost the PHP installation of a Drupal 7 site just before a lot of updates were about to be applied. I still have the Drupal database.

If I install a current version of Drupal, it may be out of sync with the database (missing columns that were added by some update etc).

So, how can a new Drupal installation be grafted onto an old database?


texts:
Is it posible to make a copy of primary menu with changed paths?

For example instead of node/56, I need to rewrite the path to node/56/edit.
The purpose of this is to have the new menu in my Admin Panel, so the site administrator can click on a link to go directly to node edit page.


texts:
I need to POST the data in a form to an external URL.

In Drupal 7, you would use

$form['#action'] = url('http://example.com', array('external' => true));

Or maybe this was for GET. Anyway... in Drupal 8, this does not work. I have tried editing the submitForm method:

public function submitForm(array &$form, FormStateInterface $form_state) {
    $response = new TrustedRedirectResponse('http://example.com');
    $response->send();
}

This works, however I have not found a way to submit the values of the form along with the request. I looked at the httpClient class, but it seems that is for sending/requesting data only and does not redirect the user.

Hope someone can help me out. If it comes down to it I am fine with using GET instead.


texts: How do I redirect from an existing file?

texts:
I have the Redirect module installed, but when I add a redirect from an existing file to a new file, the redirect doesn't activate.

I did some digging and found a post suggesting that Drupal can't redirect a file if it already exists, it can only redirect from 404 or pages. Is this true? Is there really no way to redirect from an existing file?

And if it is true, how do I delete the file? There doesn't seem to be a way to delete a file once it is uploaded. The file was originally attached to a content item but that content has since been deleted.


texts: How can I have node pages with Fivestar or comment fields cached properly?

texts:
I was struggling with high page load time for my node pages when I realized that the problem was due to content pages not being cached (html render cache). The page is rebuilt after every single request. With some hit and trial, I realized that fields that have form elements, in my case, Fivestar widget and also the comment form at the bottom of the page prevent page from getting cached. Either of these fields cause this problem.
When I remove those two fields, page starts to get cached.
Has anyone else dealt with a similar issue? What is the best recommended approach to make sure the page continues to get cached?


texts: php and html tag problem when customizing menu items

texts:
I was trying to print the menu item description under the menu name.

I add this into the menu.inc under bootstrap theme, where the function bootstrap_menu_link(array $variables) is:

if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){
    $element['#title'] .="
 " . $element['#localized_options']['attributes']['title'];
  }

my interface then showed something like product
LED Drivers as the menu item - the
 tag is printed out directly. I looked at the source code, that area shows: &lt;br&gt; , so I then tried using &lt;br&gt; in the php string, but the source code showed &amp;lt;br&amp;gt; this time. How can I correctly insert html tag into $element['#title']?


texts: How to remove a taxonomy vocabulary via database query

texts:
To manually remove a taxonomy vocabulary in the database, what tables/columns etcetera do I need to delete or modify?

I have a "ghost" taxonomy - it shows up in the list, but doesn't exist anywhere else. I cannot edit it through the website admin - it says page doesn't exist. I can't delete it by using drush entup

But I must remove this somehow, as it's disrupting the website with errors...

  LogicException: Missing bundle entity, entity type taxonomy_vocabulary, entity id Regions

As a hook_update_n solution didn't work, and installing a module to do 'drush entup' didn't work... where can I remove this from the database? I had the team in charge of the database itself do a search and pull this result:

I'm assuming that first result is for the block structure, and unrelated to my taxonomy. But maybe someone sees an issue with the results below it, or if we can safely delete those to get rid of this 'ghost' taxonomy?


texts: Is it possible to set the OG audience of a node to the audience of its referenced node using Rules?

texts:
I'm working on a D7 helpdesk distro with four content types: Organization, Case, Internal Note, External Note. Notes are linked to a Case via node reference. To allow users to see only the Cases that belong to their Organization, each Organization is an Organic Group and each Case gets an Organization as its OG audience.

I plan to hide the OG piece on the Note form and have it automatically set to the same OG audience as its Case using a Rule. However, I can't seem to get the Rule written properly. Any advice?


texts: jQuery.js not loading after enabling custom module

texts:
I have written my custom module for Drupal 7. In my page_change.module file I have only:

<?php
    drupal_add_js(drupal_get_path('module', 'page_change') . '/page_change.js');
?>

In my page_change.js file I have only:

Drupal.behaviors.page_change = {
    attach: function (context) {
        console.log("text");
    }
};

As soon as I enable my module, Drupal doesn't load jquery.js. It does not even appear in html source in <head> section. When I disable my module, or delete the only line from page_change.module file everything works fine.

I have also tried to load my javascript file by adding

scripts[] = page_change.js

In my page_change.info file (and leaving page_change.module with only <?php ?>) but it doesn't seem to work either.

Why does that happen? What am I doing wrong? Am I missing something?

edit: I have even tried to add inline javascript by adding

drupal_add_js('console.log("text");', array('type' => 'inline', 'scope' => 'footer'));

and it writes text to console, but jquery.js is still missing.


texts: Modules are not showing in the list of modules

texts:
When I add new modules in the production website, they don't shown up the list of modules. So, I took a copy, and changed the values in the database, the content of the settings.php file, and the modules are listed in the local machine.

Before this post, I took some debugging measures, which are:

I checked that sites/all/modules has the file permissions 755
I checked the module version is correct
I cleared the cache table


texts: How to append a Value in cck field in a for loop?

texts:
I want to keep a progress field in my content type so i can update value in it. But it doesn't take the previous value if saved in for loop.

for($i = 1; $i<=5; $i++) {
    $mynode = node_load(6);
    $myprevious = $mynode->field_progress[0]['value'];
    drupal_set_message("My Previous".$myprevious);
    $mynode->field_progress[0]['value'] = $myprevious." ".$i." ";
    node_submit($mynode);
    node_save($mynode);
}
$mynode = node_load(6);
drupal_set_message("My Value".$mynode->field_progress[0]['value']);
$myprevous_progress = $mynode->field_progress[0]['value'];
$mynode->field_progress[0]['value'] = $myprevous_progress.' end.'.$myprevous_progress;
node_save($mynode);

Output on page :

My Previous
My Previous
My Previous
My Previous
My Previous
My Value


texts: Alter element_info and troubleshoot changed elements

texts:
Ubercart defines the following uc_price type in uc_store_element_info:

$types['uc_price'] = array(
  '#input' => TRUE,
  '#size' => 15,
  '#maxlength' => 15,
  '#autocomplete_path' => FALSE,
  '#process' => array('ajax_process_form'),
  '#element_validate' => array('uc_store_validate_number'),
  '#theme' => 'textfield',
  '#theme_wrappers' => array('form_element'),
  '#field_prefix' => $sign_flag ? '' : $currency_sign,
  '#field_suffix' => $sign_flag ? $currency_sign : '',
  '#allow_negative' => FALSE,
  '#empty_zero' => TRUE,
);

Assume I want to allow negative prices by setting #allow_negative to TRUE. (Maybe this is a bad idea, but play along.) Maybe I will need to replace the #element_validate array with a custom function as well.

From reading the API documentation here: https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_element_info_alter/7.x it looks as if making a custom module and implementing hook_element_info_alter should let me do this. I made a module called customcode and implemented the following function:

function customcode_element_info_alter(&$type) {
  drupal_set_message('Altering uc_price');
  if (isset($type['uc_price'])) {
    $type['uc_price']['#allow_negative'] = TRUE;
  }
} /* end hook_element_info_alter */

but this does not work. Maybe this does not work for obvious reasons but I am pretty confused, and web searching (on this site and elsewhere) is not clearing up my confusion. I could easily believe I am specifying the array element incorrectly, but without troubleshooting information it's difficult to figure out what is going on.

Here are some questions:

How do I see the value of the $type array? When troubleshooting other forms I have used print_var or dpm, but those do not do anything here. I do not understand at what point this code is executed and how to display output from it. The drupal_set_message displays nothing.
Is hook_element_info_alter the way I want to modify this element? If not, what approach should I take? I obviously do not want to hack the Ubercart module unless there is no other choice.
If so, is creating the function with the name I have chosen (customcode_element_info_alter) correct? When I use hook_form_alter I need to include the original form ID in the name. I do not understand how this hook knows enough to alter the data in uc_store_element_info.

Thanks for any help you can offer.


texts:
I have so many content type like article, contribution, event, c_program etc.

For all content url alias is,

[site_name]/[content type name]/title

But we have some url alias that are like this,

[site name]/title

So, I want to list all url of,

[site name]/title format

How I can I list them out?


texts: HTML isn't rendering, HTML tags are being printed

texts:
I added a view template views-view-fields--nieuws--page.html.twig to my theme.

The template is correct, when I edit it I see the results on my website.

{% for field in fields %}
  {{ field.separator }}
  {{ field.wrapper_prefix }}
    {{ field.label_html }}
    {{ field.content }}
  {{ field.wrapper_suffix }}
{% endfor %}

In page.html.twig I print the region like this:

{{ page.content }}

But my output has HTML tags in it, any idea how I can solve this?

EDIT: It appears my HTML is rendering at all through Twig

{% set hello = 'Hello' %}
{{ hello }}

outputs the  tags, too.


texts: Get all the machine names of the date formats

texts:
I have searched the Drupal documentation but until now I have not found the way to obtain the machine names of the date formats that the user creates from the Drupal administration.

They would be the formats that appear in the following route:

admin/config/regional/date-time

What would be the way to obtain them?
Is there any service for this?


texts:
I have a form, and I want to get the selected value of $form['dropdown_third'] and then use the value to create my table.

What should I write in Submit function?

function find_tryk_filter_test_page($form, &$form_state) {

$options_first = find_tryk_filter_test_first_dropdown_options();
$value_dropdown_first = isset($form_state['values']['dropdown_first']) ? $form_state['values']['dropdown_first'] : key($options_first);

$form['dropdown_first'] = array(
    '#type' => 'select',
    '#title' => 'Type',
    '#options' => $options_first,
    '#default_value' => $value_dropdown_first,
    '#ajax' => array(
        'event' => 'change',
        'callback' => 'find_tryk_filter_test_ajax_callback',
        'wrapper' => 'dropdown_second_replace',
    ),
);

$form['dropdown_second'] = array(
    '#type' => 'select',
    '#title' => 'Producent',
    '#prefix' => '
',
    '#suffix' => '
',
    '#options' => find_tryk_filter_test_second_dropdown_options($value_dropdown_first),
    '#default_value' => isset($form_state['values']['dropdown_second']) ? $form_state['values']['dropdown_second'] : '',
    '#ajax' => array(
        'event' => 'change',
        'callback' => 'find_tryk_filter_test_2_ajax_callback',
        'wrapper' => 'dropdown_third_replace',
    ),
);

if (!empty($value_dropdown_second)){
    $options_second = find_tryk_filter_test_second_dropdown_options($value_dropdown_second);
    $value_dropdown_second = isset($form_state['values']['dropdown_second']) ? $form_state['values']['dropdown_second'] : key($options_second);
}else{
    $options_second = array();
    $value_dropdown_second = isset($form_state['values']['dropdown_second']) ? $form_state['values']['dropdown_second'] : key($options_second);
}

//echo $options_second;
$form['dropdown_third'] = array(
    '#type' => 'select',
    '#title' => 'Model',
    '#prefix' => '
',
    '#suffix' => '
',
    '#options' => find_tryk_filter_test_third_dropdown_options($value_dropdown_second),
    '#default_value' => isset($form_state['values']['dropdown_third']) ? $form_state['values']['dropdown_third'] : '',
);

$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Find trykluft element'),
    '#ajax' => array(
        'callback' => 'find_tryk_filter_test_ajax_result_callback',
        'wrapper' => 'result-wrapper',
        'method' => 'replace',
        'effect' => 'fade',
        '#prefix' => '
',
        '#suffix' => '
'
    ),
);

$header = array('Navn', 'Shoplink', 'Brochure');

$options_third = find_tryk_filter_test_third_dropdown_options($value_dropdown_second);
$value_dropdown_third = isset($form_state['values']['dropdown_third']) ? $form_state['values']['dropdown_third'] : key(0);
$query = db_query("SELECT node.title, fdfs.field_shoplink_value, fm.uri
    FROM node
    JOIN field_data_field_model AS fdfm ON
    fdfm.entity_id = node.nid
    JOIN field_data_field_producent AS fdfp ON
    fdfm.entity_id = fdfp.entity_id
    JOIN field_data_field_shoplink AS fdfs
    ON fdfs.entity_id = fdfm.entity_id
    JOIN field_data_field_brochure AS fdfb
    ON fdfb.entity_id = fdfm.entity_id
    JOIN file_managed AS fm ON
    fm.fid = fdfb.field_brochure_fid
    JOIN taxonomy_term_data AS ttd
    ON fdfp.field_producent_tid = ttd.tid
    WHERE fdfm.field_model_value = '".$value_dropdown_third."'");

$rows = array();

foreach ($query as $row) {
    $rows[] = array($row->title, $row->field_shoplink_value, $row->uri);
}

$form['webform_results'] = array(
  '#theme' => 'table',
  '#rows' => $rows,
  '#header' => $header
);

return $form;

}


texts:
How can the reCAPTCHA module be applied to a node's comment field in Drupal 8?

This particular node has a comment field added with the machine name field_story_comments.

That field is a custom comment type with the machine name resource_comments.

I have tried to add both field_story_comments and resource_comments under /admin/config/people/captcha/captcha-points, but am not seeing any CAPTCHA for that nodes' comment field.


texts: Altering relationship in Views contextually

texts:
I need to alter a Views relationship contextually: since the View is embedded into another node, the relationship is defined by a field's value of a parent node.

I presume the only way to add a relationship is using hook_views_data_alter, but I'm not quite sure if it's going to work inside a preprocessor function (I'm creating a View for a certain node type) and what's the proper way of using it. The related field will be a Nodequeue instance (Nodequeue module is integrated with Views using relationships), its name will be contained in that parent node's field.

Thanks in advance!


texts: How to pass argument to php file using a drush command?

texts:
I've small php script in my public folder called sample.php. I run this file using drush command drush scr sample.php.

I want to know how to pass argument to php file using drush command and how to get arguments in php file?


texts: Why does my Pie Chart only show 1 out of multiple fields?

texts:
I'm attempting to create a pie chart views block with Google Chart Tools. It has multiple fields with numeric values for each field. The column chart of it works great, as shown in this screenshot:

But for some reason the corresponding pie chart always displays only one of those fields (with 100%), as shown in this screenshot:

What am I doing wrong?


texts: Drush modifying variable on settings.php

texts:
Can I modify a variable of the setting php via drush?
I actually want to change

ini_set('session.cookie_lifetime', 2000000);

to

ini_set('session.cookie_lifetime', 0);


texts: Twig conditions for node/page/view in page-title.html

texts:
I am trying to set different classes in the page-title.html.twig based on what drupal is actually showing. The first condition works in a node template, but not in the page-title.html. This is a pseudo-code of what I am trying to achieve:

{%
  set classes = [
    'title--h1',
    node.type.entity.label == 'Blogpost' ? 'ico ico--time',
    page.machine_name == 'about_me' ? 'ico ico--world',
    view.machine_name == 'blogpost_list' ? 'ico ico--target'
  ]
%}


texts: Programmatically set max image size on custom module field

texts:
I've got a custom module which creates a custom content type with an image field (among other fields). I would like to require the image to be a certain size and a certain file extension. I've got the file extension restriction working, but I don't know how to set the maximum and minimum image sizes.

'my_image_field' => array(
    'field_name'  => 'my_image_field',
    'label' => t('Upload 512 x 512 Icon: '),
    'widget'      => array(
        'type'    => 'image_image',
    ),
    'settings' => array(
        'file_extensions' => 'png',
    ),
),

Any ideas?


texts: GMaps page with a marker pin on your location based on address we supply

texts: i want to add marker directly on Gmaps on location based on address we supply. Or else i want the location based on name, longitude and latitude what we supply. FYI: i am  using gmap and locatin modules for druapl 7. Please help on the same. Thank you in adavance


texts:
I am trying to perform an AJAX post on node edit pages in a new module I created Proofread Bot. This module adds a button and clicking it performs an AJAX post to a URL for processing text. When I do this on node edit, it seems the whole page gets submitted.
I tried adding an event.preventdefault call, but also returning false for the button doesn't work.
Let me add the same code works like magic on node view.
Here is the code:

function proofread_bot_node_prepare($node)  {

drupal_add_js('
    jQuery(document).ready(function(){
    jQuery("#edit-body").before(\'
<button type="button"  id="proofread_bot-submit" onclick="return false;">Check with Proofread Bot</button>
\');
    jQuery("#proofread_bot-submit").click(function(event){
      event.preventDefault();
      jQuery.ajax({
         type: "POST",
         url: "proofread_bot/check",
         dataType: "html",
         data: {"text": jQuery("#edit-' . variable_get('proofread_bot_field') . '").html()
          },
         success: function(proofread_result){
            jQuery("#proofread_bot-submit").after(proofread_result);
         }
        });
      });
    });
    ', 'inline');

}


texts: views exposed filter on field collection item

texts:
I use views-7.x-3.3 and field_collection-7.x-1.x-dev of 2012 Jun 28.

I have a very simple content type (person) with the following fields:

name: text
surname: text
mother language: term reference [en, fr, de]
portfolio: field collection of:

website language: term reference [en, fr, de]
url: link

I can create an exposed views filter on the mother language field just fine. The drop down appears and correctly filters the nodes as expected.

When I try to create a filter on the website language field of the portfolio field collection though, it fails to filter. No results are returned unless the dropdown value is set to "all".

Is it the case that field collection fields cannot participate in views filters? Is there a solution to that?


texts: How to hide language switcher block if node has no translation?

texts:
Having a bilingual site here. Some nodes are translated and language switcher works fine. But the switcher block also shows up on nodes which aren't translated. Then the untranslated language link has a different styling.

How can I hide the switcher when there's no (other) translation of the node? I looked up variables in all preprocess functions without finding any indicators. What do I have to look for? And how then can I hide the switcher?


texts:
i would like to create a filter in order to only display artist who have Lips focused in the third column. (I don't want an exposed filter).
In this case i would like to only display artist2 , laradelvaux and bdash01

Another example: if the fourth column contains Nude Look, then only bdash01 will be display.

The fourth column is dynamic. The values can be: Contouring & Brows or Eyes Focused or Lips Focused or Natural Look or...

I tried many modules with no success:

Views Reference Filter, Views Dependent Filters, Views Selective Filters, Views Filter Field, Views Global Filter and many others.

(I'm not friendly with PHP).

I tried to use Views PHP
with this custom filter (screenshot) but it does not work.


texts: One exposed filter with different values in one view

texts:
I've searched a lot for this one with no luck.
My problem is the following:

I have an exposed filter of brands (adidas, nike, etc). It is displayed as a block on the home page.
while entering the brand and click apply, it displays a page containing two content types mall and store.

the store content type contains a term reference field brand.
As for the mall content type, it contains entity reference stores with term reference field brand in them.

If i add a relationship in the views for the referenced entity and enable the relationship on the exposed filter field brand, it will display the mall content type only. if i remove the relationship it will display the store content type only.

How can I have one exposed filter block to display both the malls and the stores?

I appreciate any help given.

I'm using drupal 7.


texts: Multivalue field with Twig and its length

texts:
I am playing around with Twig and D8. I created a content type called community and it contains a field called field_banner_images which is an image field with a max limit of 10 images.

I am trying to get the length of field_banner_images via Twig, but the number I am receiving is incorrect. My current node has 10 images on it. It also has alt text enabled if that makes a difference.

I created a file called node--community.html.twig and inside I have:

{{ content.field_banner_images|length }}

which outputs 26, which is wrong. I would expect it to output 10.

Furthermore, I add

{% for item in content.field_banner_images %}
  {{ content.field_banner_images[loop.index0] }}
{% endfor %}

and while it does output the 10 images wrapped in span elements, I also get 16 empty span elements since it is looping 26 times.

What am I doing wrong here?


texts: How to log and display all the users that have edited a node (without revisioning)?

texts:
We need to keep the usernames of the latest editors of content, along with the edit date.

How can we do so? Or should we use custom code?

We do not want to enable revisioning, as it is more complex than we want.


texts: ajax_comments does not show new comment entry

texts:
I been sitting over this nearly 4 hours and can't solve that issue.

The problem is, that newly created comments will not get displayed after submit was clicked, not even the message "comment has been posted" does appear either. Instead it shows me an new empty comments entry form. They get shown when I reload the page.
If I answer on an existing comment, the answer is shown after submit and also the message does appear. So that works as expected.

I use the production release of the comments module (7.x-1.0-alpha1), also installed the development release (7.x-1.x-dev) just to see if there's any change in behaviour.

I know there been almost similar questions regarding this problem, but none of them seem to help me. I also installed the "block_refresh" module as suggested in another question, but it does not help either. Even though it is for block refreshes, so I actually didn't expect this to work (I just gave it a try).

I use the comments on a news page (created a news content type).

So if anybody could give me a hint where to look or what to change, test, etc, would be greatly appreciated. I know my problem description is not very helpful, but maybe somebody ran into the same issue and can give me some ideas.

Thanks for helping out!!


texts: How can I add exceptions to the files the Hacked! module looks at?

texts:
I use the Hacked! module, which I generally like, but I also delete all the unnecessary text files from the Drupal root (*.txt except of course for robots.txt) because they just clutter up my root.  (As an aside, they ought to be moved to /docs or something like that in Drupal 8.)

How would I make Hacked! ignore them (even if I have to hack Hacked!)?


texts: how to select different colorbox styles for different content types in drupal 7?

texts:
i tried to select different colorbox styles for different content types but i couln't. because we can select only one colorbox style for all using.

if onybody know how can select different colorbox style for different content type please help me


texts:
when i go to admin/people section. it is showing  me

username, roles, etc.

I want to show first_name, last_name as well.

is there is any way to do this

Thanks