texts: How to enter incomplete or partial date with date module? (Day-Month-Year / Month-Year / Year)

texts:
I have a content type A and it has a date field.

I'm selecting Day-Month-Year for this date field. But not every content has a day and I want to select only Month and Year for these content.

If I select (enter) only month and year, it gives error:

  The value input for field Date is invalid: The value March 1979 does
  not match the expected format.

I installed and tried the Partial Date module but still couldn't do what I want although it says on the module page:

  This module provides date and time fields that allows any individual
  component to be left blank, while still providing a sortable listing
  of the fields.

How can I do that? I want to enter full date (Day-Month-Year) for some nodes and for some others partial date (only Month-Year) and maybe for some others only Year. Isn't this possible?

Day-Month-Year
Month-Year
Year

(And also there is an unsolved issue about this: Allow "fuzzy" granularity.)


texts: Custom Key Value fields in a content type

texts:
I am searching for functionality similar to the Double Field module only for Drupal 6.

Does anyone know of a suitable module or if not, could you outline an approach to creating this functionality?

Thanks, apologies if this is poorly explained.


texts: How to validate input data that are previously saved?

texts:
I am creating a module that can store user input in db and populate in a listing page with validation. I am collecting all values before submit i.e. any change in any field I store the form state in database, next I need to validate it on a listing page which will validate those input and give the error.

I have tried node_validate_form & drupal_validate_form but it's not working.

I think drupal_validate_form will do what I want but it omit default field validation like required validation or email validation are not validating properly and also in listing page it only validate the 1st one after that it is not checking any validation.

$header = array(
    array('data' => t('Field')),
    array('data' => t('Error')),
  );
  $rows = array();
  $owner = '';
  $result = db_select('MY_MODULE', 'lt')
    ->fields('lt', array('owner', 'form_state', 'form_state_input'))
    ->condition('lid', $lid)
    ->range(0,1)
    ->execute();

  if (!$result) {
    $rows[] = array(array('data' => t('No Result found.'), 'colspan' => 10));
  }
  else {
    $old_msg = drupal_get_messages();
    $_SESSION['messages'] = array();
    $node_form = (object) array(
      'type' => 'MY_CONTENT_TYPE',
      'language' => LANGUAGE_NONE,
    );
    $form = drupal_get_form('MY_CONTENT_TYPE_node_form',$node_form);
    $form['#submit'] = array('#type' => 'submit', '#value' => t('Next'));
    foreach($result as $r){
        $owner = l(t(user_load($r->owner)->name), 'user/'.$r->owner);
        $old_fs = @unserialize($r->form_state);
        $form_state_input = @unserialize($r->form_state_input);
        $old_fs['values']['uid'] = $user->uid;
        $form_state = array();
        $form_state['values'] = array_merge($old_fs['values'],$form_state_input);
        $form_state['values']['op'] = t('Save');
        $form_state['submitted'] = 1;
        $form_state['complete form'] = array();
        $form_state['rebuild'] = TRUE;
        $form_state['triggering_element'] = array('#parents'=>array('next'),'#button_type'=>'submit');
        unset($form['#token']);
        drupal_validate_form('MY_CONTENT_TYPE_node_form', $form, $form_state);
        $errors = form_get_errors();
        $noOfError = 'empty';
        if (!empty($errors)) {
          $noOfError = count($errors);
          foreach($errors as $field => $error){
            $field_name = explode(']',$field,2);
            $info = field_info_instance('node',$field_name[0],'MY_CONTENT_TYPE');
            $rows[] = array(
                    array('data' => $info['label']),
                    array('data' => $error),
                  );
          }
        }
        else{
          $rows[] = array(array('data' => t('No Error found.'), 'colspan' => 10));
        }
        form_clear_error();
    }
    $_SESSION['messages'] = $old_msg;
  }
  $build = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array('id' => 'MY_MODULE'),
  );

Thank You In Advance....:)


texts:
I am trying to add mega menu to my website. For the mega menu, i am using menu mini panels. But, i am a bit confused to use it. What i need is: adding views content to the mega menu. But, after i read some of references, i don't really understand about how to do it in a simple way. Here is the display that i want to achieve:

-left sidebar -- mineral block -- mouse over -- display mega menu (contain views content).

Anyone could help me? Thank you.


texts: How can I re-format (not validate) the value of a field that a user inputs into a node?

texts:
I am using the Addressfield module to allow users to input addresses.  I am then using the Location Taxonomize module to generate a taxonomy based on these addresses.

To make everything consistent, I would like to automatically capitalize the first (and only the first) letter of every word (I know there are exceptions where multiple words should be capitalized, but I am willing to deal with those manually).

How can I implement this?


texts: Display a field for a specific amount of time

texts:
I'd like to place a small overlay on my video called "New". So I downloaded the date module and added a date field to my video content type.

Anyone know if its possible to then output the date field (which I can style with CSS) only for a certain period of time like a week or two? After a set date the field would not be output.

Thanks guys!

Update: I have found a module called fieldscheduler that will schedule a field, but I cannot schedule a specific node, only all nodes that use that field. So close!


texts: Cannot view individual article, instead the node's link displays all articles

texts:
I cannot figure out what I am doing wrong. I'm using Drupal 7 and the Omega theme. I'm using pathauto to have nice paths. I have the built-in article content type which I renamed to "news". The pattern for news articles is set to news/[node:title]. I created a view to list all the news and gave it the path "news".

When I went to /news I saw my view. When I clicked on an individual article, I got a file not found error with the entire web page layout embedded and repeated twice and then a third time with the individual article displayed. I also got a php "Warning: Cannot modify header information - headers already sent" error.

Thinking that using the pattern news/[node:title] and also creating a view with the path "news" was the problem, I changed the path of the view to "all-news". Visiting an individual article with its path "news/[node:title]" still gives me the file not found errors and the multiple embedded pages with the cannot modify header errors. The only way to see my individual article was to use the path all-news/[node:title].

Next, I disabled the view. Now I only get file not found errors for my articles when I use the url pattern "news/[node:title]" and no multiple embedding of the entire web page.

I think there is something I'm completely not understanding. My goal is to have a news section of the site, and to use taxonomy to organize the articles by topic. Can you tell me where I might have made a mistake?


texts: Unable to edit node translation other than current language

texts:
On my multilingual site I seem to have problem at admin/content when editing a particular translation.

I have a Contact Us page, translated:

Contact Us [EN], node/286
Contact Us [ES], node/300

I don't have an explicit Path Translation set, but the nodes are bound together, in the Translate tab.

Now the problem is, that when my current language is English and I want to edit the Spanish version from the Content listing, the edit link takes me to its English version (node/286). Apparently the admin overlay inherits the language prefix and forces the English translations to open.

What luckily works correctly is editing the node from within its view (by hitting the Edit tab).

Is this normal behavior?


texts: Why the ETAG always change of my D7 site

texts:
ETAG should not change if the page not changed.

But when I refresh the web page after login, the ETAG always change.


texts: Image gallery where I can insert images and video

texts:
I'm new to Drupal and is looking for at image gallery, where I can insert images and video, does such exist?

I have tried to search around, but unfortunately without any luck.


texts:
I would like to set up more filtering for the 'People' list in a D7 site -- by username and also by other fields I've attached to my users.

I haven't yet seen any way to hook into or modify the default functionality (please update me if I am mistaken). I did some googling and found reference to the Views Bulk Operation, but even the maintainer said very recently that it's still buggy, so I don't want to use it.

I also found this page which recommends creating a view -- is this the way I should do it?


texts: D7: How do export content types, module settings, taxonomy terms, webforms and other nodes?

texts:
It seems D7 lacks an important feature for migrating data content types, module settings, taxonomy terms, webforms and other nodes.

I tried with Features modules but it seems it creates modules out of features and this is bad.

Where is Drupal CCK Content Copy Module  for Drupal 7?


texts:
In setting up a new Drupal 7 site, I went to try out the password reset option, and while I received the password reset email just fine, clicking it takes me to a page with an error "You have tried to use a one-time login link that has either been used or is no longer valid".

I've tried sending the reset email a few times and clicking the link immediately each time, and keep getting the same error message. What sort of things make a reset link "no longer valid"? I'm working on a staging server that will be translated to a live server, so URLs and cookie paths might be getting tangled; where do I need to start looking to unravel this?

Note: The user accounts being tested were imported using the Migrate module from another system, hence their passwords are invalid, and I'm hoping users can just request a new password to login.


texts: Ajax submission not working for Webform within a node

texts:
I am working with a feature where a newsletter subscription form (Webform with ajax submission and confirmation type is inline) should appear in a node. The node would be showing as a popup and the contents of popup is being loaded using ajax. When the node is tested in it's own node page the submission is working fine but not in the popup.It is redirecting to another page. Inspecting the two cases, i found that the webform while being loaded in popup, lacks event handler that should refer to form submission.
In the controller where webform being loaded into the popup block, something like this is tried:
  $webform = $this->entityTypeManager->getStorage('webform')->load($formId);
  $view_builder = $this->entityTypeManager->getViewBuilder('webform');
  $build = $view_builder->view($webform);

Where $formId is the id of the webform and entityTypeManager is an instance of Drupal\Core\Entity\EntityTypeManagerInterface.
Later this $build is being saved as the webform attribute of popup class and later being rendered. The fields of the webform appears to be loaded correctly but not the event of submission form.
Any suggestion for solving the issue?


texts: Unlimited values field in Drupal 7 - how to show extra field in page.tpl.php

texts:
I know how can I retrieve the first file name

$fileupload = $node->field_fileupload[$node->language][0]['filename'];

but how can I retrieve the other unlimited file names


texts: Custom view sort plugin not working only when used in table sorting

texts:
We have a view of committee memberships (= custom entity). The committee memberships hold references to the committee and the politician and have a field "role". In a view we want to output all committee memberships in a logical order: chairperson first, the vice chairperson, foreperson, spokesperson and member. As you can see alphabetical order is not suitable.
We defined a custom view sort plugin which is playing nice on simple views where the sorting is set in the views configuration. However on a table view when selecting the column for the sorting by role it is not called.
Examples:

https://www.abgeordnetenwatch.de/bundestag/19/ausschuesse/1-untersuchungsausschuss-terroranschlag-auf-dem-breitscheidplatz - the sorting is correct
https://www.abgeordnetenwatch.de/bundestag/19/ausschuesse/1-untersuchungsausschuss-terroranschlag-auf-dem-breitscheidplatz/tabelle#filterbar the committee members are sorted by last name by default (we will change this)... when you click on the last column heading "Rolle im Ausschuss" it should be the same order as the first example. But it is sorted by the key of the role stored in database. "Stellv. Mitglied" has the key "alternate_member" in database that is why these members come first in this table

We defined the plugin in the following way in a class extending EntityViewsData:
$data['committee_membership']['committee_role']['sort']['id'] = 'sort_committee_membership';

The plugin is that:
/**
 * Sort handler for sorting committee memberships by list key position.
 *
 * @ingroup views_sort_handlers
 *
 * @ViewsSort("sort_committee_membership")
 */
class SortCommitteeMembership extends SortPluginBase {

  public function query() {
    $this->ensureMyTable();
    $field_storage = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('committee_membership')[$this->field];
    $allowed_values = array_keys(options_allowed_values($field_storage));
    $formula = 'FIELD(' . $this->tableAlias . '.' . $this->field . ', ' . implode(', ', array_map(array(Database::getConnection(), 'quote'), $allowed_values)) . ')';

    $this->query->addOrderBy(NULL, $formula, $this->options['order'], $this->tableAlias . '_' . $this->field . '_keys');
  }

}

Is there something missing which is needed to implement when the sorting is exposed?!


texts:
I have this problem in Drupal Commerce: a line item should change the price of my product, that is based on customizing the users (ex. product base $10 with customization $12, customization is line items).

This is possible working on Rules, but you only see final price after you add the product on cart, I should instead see the price change in ajax so the users see final process before add to cart.

I've not found solutions online. The basic scenario is like this:

You buy a shirt based  =$10
The user customizes the shirt with your name and = $12
The user customizes name and logo = $14

I am working with Kickstart 2.0


texts:
i need to show in my site the social media counter like Facebook fans count ...

its some thing like :-


texts:
I am trying to ajaxify my site. I want the "Main page content" to be passed via an ajax-command to a custom js-function.

To accomplish this I would do the following:

I need to register a path for my ajax requests

code:

$items['_custom_ajax_'] = array(
  'title' => 'AHAH callback',
  'page callback' => 'ajax_form_callback',
  'delivery callback' => '_custom_ajax_deliver',
  'access callback' => TRUE,
  'theme callback' => 'ajax_base_page_theme',
  'type' => MENU_CALLBACK,
);

use a custom delivery callback function _custom_ajax_deliver which is the copy of the ajax_deliver()

original code:

function ajax_deliver($page_callback_result) {
  // Browsers do not allow JavaScript to read the contents of a user's local
  // files. To work around that, the jQuery Form plugin submits forms containing
  // a file input element to an IFRAME, instead of using XHR. Browsers do not
  // normally expect JSON strings as content within an IFRAME, so the response
  // must be customized accordingly.
  // @see http://malsup.com/jquery/form/#file-upload
  // @see Drupal.ajax.prototype.beforeSend()
  $iframe_upload = !empty($_POST['ajax_iframe_upload']);

  // Emit a Content-Type HTTP header if none has been added by the page callback
  // or by a wrapping delivery callback.
  if (is_null(drupal_get_http_header('Content-Type'))) {
    if (!$iframe_upload) {
      // Standard JSON can be returned to a browser's XHR object, and to
      // non-browser user agents.
      // @see http://www.ietf.org/rfc/rfc4627.txt?number=4627
      drupal_add_http_header('Content-Type', 'application/json; charset=utf-8');
    }
    else {
      // Browser IFRAMEs expect HTML. With most other content types, Internet
      // Explorer presents the user with a download prompt.
      drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
    }
  }

  // Print the response.
  $commands = ajax_prepare_response($page_callback_result);
  $json = ajax_render($commands);
  if (!$iframe_upload) {
    // Standard JSON can be returned to a browser's XHR object, and to
    // non-browser user agents.
    print $json;
  }
  else {
    // Browser IFRAMEs expect HTML. Browser extensions, such as Linkification
    // and Skype's Browser Highlighter, convert URLs, phone numbers, etc. into
    // links. This corrupts the JSON response. Protect the integrity of the
    // JSON data by making it the value of a textarea.
    // @see http://malsup.com/jquery/form/#file-upload
    // @see http://drupal.org/node/1009382
    print '<textarea>' . $json . '</textarea>';
  }

  // Perform end-of-request tasks.
  ajax_footer();
}

create an custom function which do the ajax request like Drupal.ajax
bind the ajax request to some selector e.g. a.ajaxify
add a custom ajax-command

Im not sure if this is the right way, or if I can extend the core easier somehow.
Basicly my approach is simmilar  to the module Ajaxify Drupal with JQuery Ajax

Better Ideas?

Update: one more thing – I need an event to be triggered everytime an ajax-link is clicked.


texts: After setting $base_url, I can only access the front page

texts:
I have Drupal installed in a subdirectory of public_html on BlueHost.

It looks like this: /www/drupal7/mywebsite.

I want to run the site out of the mywebsite subdirectory instead of www.  However, I want the URL to appear to be http://mywebsite.com.

Here is the suggested .htaccess configuration from BlueHost.  This is the .htaccess for the www/ directory; I am using the default Drupal 7 .htaccess in Drupal's subdirectory.

# BlueHost.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]

This successfully allows me to use Drupal from the subdirectory, but the URLs look like this:

http://www.mywebsite.com/drupal7/mywebsite/PAGE

But I want it to look like this:

http://www.mywebsite.com/PAGE

This post on Drupal.org suggests that the $base_url must be set in default/settings.php.  I set the $base_url to "http://mywebsite.com"; however, when I do this, whatever link I click, I am redirected to the front page.

Is there an additional step?  What am I missing?


texts: How to add Login/Register link in the right header in Skeleton theme

texts:
I am using Skeleton theme with Drupal 7 in my website. Below is a screenshot of it-

As you can see, the right header is completely empty here. I want to add "Login | Register" links in this block in the following manner-


texts: how to use token in "Execute custom PHP code" in a rule

texts:
I used "Execute custom PHP code" in my pricing rule.

However I got Notice when I checkout:

  Notice: Use of undefined constant testsku - assumed 'testsku' in eval() (line 7 of /var/www/jmu/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code).
  Notice: Undefined variable: line_item in eval() (line 7 of /var/www/jmu/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code).

I know there must be something wrong with my token replace code:

$line_item_label = token_replace([commerce-line-item:line-item-label],array('commerce_line_item' =>$line_item));

I used "line-item-label" as product sku's machine name

Anyone have any idea about this?


texts: three servers serving same content, one Drupal database: implications for cron, etc

texts:
We have an intranet with one primary, master server (let's call it #1) and two backups (#2 and #3), and I want users to be able to use any of them interchangeably. For our other applications, #1 is a MySQL master, the other two are slaves, but all the reads as well as the writes are done on #1 and it works just fine. Now I have a Drupal installation on #1. I copied all the files on #1 to #2 and #3, including the database settings, so all the sites access the database on #1, and it all appears to be working fine.

My question relates to cron. Any module that implements a cron hook can do anything it has permission to do, right? Both database and filesystem access. So how should I set up cron on servers 2 and 3? I discovered (by mindlessly coping my cron entry from #1 to #2 and #3) that you get an error when you try to run cron with cron already running (thankfully). So I've disabled it on #2 and #3 and started scratching my head. I need the filesystem cleanup but I don't need to try to re-run the database work.

So -- what's the best practice? Or is my whole setup ill-conceived?


texts: How do I print the node title from the object?

texts:
How do I print the title of a node entity? Printing the node object, I get this output.

stdClass Object
(
    [__CLASS__] => Drupal\node\Entity\Node
    [in_preview] =>
    [values] => Array
        (
            [vid] => Array
                (
                    [x-default] => 2
                )

            [nid] => Array
                (
                    [x-default] => 2
                )

            [type] => Array
                (
                    [x-default] => common
                )

            [title] => Array
                (
                    [x-default] => Terms of Use
                )
}


texts:
I am a newbie to Drupal/Acquia Dev Desktop. Please excuse me if this is a dumb question.

I'm trying to grasp the relationship between themes (the one I chose is Corked Screwer), blocks, and content. In Corked Screwer there are images on the top half of the page/node and my content is at the bottom.

Am I understanding correctly that Content/main page content is where my typed-in content is displayed? I can control this with Visibility Settings/Content Types, etc. Yes?

How do I go about customizing the top half of the page to replace the default images with my own? Can you point me to a good video tutorial?

Thanks!


texts:
I'm new to drupal. And I have a project that has a search block on the home page that redirects the user to a page based on the user search terms. Everything works fine but I have a FAQ page that includes all Questions and a search block and tags https://example.com/faq?keys=drupal&tags=All.
The issue is when users search for terms on the home page, it redirects the user to the question node https://example.com/faq/53335 not the FAQ page and show the user question.

How can I fix that, should I create an alter function to check if it's FAQ page so redirect the user to that page and show him the asked question?

Update:
the scenario is when user search for a term on the home page, the user will be redirected to another page that shows all search results as a list. some of the results belong to the faq page while others not. when the user clicks on the question, it'll redirect to the question node https://example.com/faq/53335, not the faq page
 https://example.com/faq?keys=drupal&tags=All

Is the faq page configured to redirect the user to the answer when there is only one answer? No, even if there is only one answer, the user will redirect to the page that shows all result. and from this page, he can click on the question.


texts: How to Group the same content into one in View?

texts:
I am using Date Module to display the view summary for a particular year and also count the contents are created in the same year.

I have created the several contents in the year of 2016 , it may contain more than 12 contents.

In each content, I have created the DATE field in the format of (Day / Month)

And, I have called all the contents in the block , while clicking the link content , the content detail should be displayed in the page.

Help me to sort out this issue


texts: How to discover the currently active twig template

texts:
I need to find out the currently active Twig template from within my module preprocess function.

function mymodule_preprocess_field(&$variables, $hook) {
    // How do i retrieve the currently active Twig template?
}

I need to know whether it is field.html.twig, field--field-example.html.twig or some other template suggestion.

Is that possible?


texts: Change Number of Values in CCK Filefield/Upload

texts:
Using hook_form_alter(), how would I change the default of 1-10 then Unlimited, to 1-24 then Unlimited?  CCK Only gives 1-10 as options before going to Unlimited and I need to have 1-24.  I know this is possible using hook_form_alter() but I do not know the syntax of how to write that.

Any help is greatly appreciated!


texts: My site was hacked, how can I use chmod permissions to avoid this?

texts:
To be honest, only the home page was switched (even the text that was modified bragged about this, grrrr!), but still... not pleasant at all.

So the important question, and something that was on my mind for a long time but never got around to ask:

which files MUST be read-only or what kind of permissions should I had to enforce in which files to make this at least a bit more difficult?

Thanks in advance.


texts:
I have a REST View with unrestricted access using the fields format. My custom fields are returned correctly for anonymous users, but the content type is empty as in the following example.

[
  {
    field_custom_1: "Hello",
    type: ""
  }
]

The only solution I found is giving the View published content permission to the anonymous user, but then anyone can can see details I don't want to be public.


texts: How to add an attribute to User reference

texts:
I would need to add an attribute to a user_reference field that "explains" the type of relationship.

Example:
My users are music players and the play in different groups.
The same user can play guitar in one group and the bass in another group.

Groups are my nodes and I can link them with the players. While I am linking them, I would also like to set the instruments they play in that group.

Group 1 - Player1|guitar
Group 2 - Player1|bass
Group 3 - Player2|guitar

Probably a way to do that is using "field collection"; is there another way?


texts:
I'm trying to use a Webforms to create a team registration form, but I was thinking to automatically generate a participants ID number in the Webform based on certain fields in the form and based on user attributes.

The ID number is composed of 5 different fields.

A group code, this is independent on the form that is being submitted
A organization code, this is a multi-organization team registration, so each organization is given a specific code embedded into a participants ID number
Team code, each group of people (or team) is also given a specific code
Person Code, each individual person is given a number so we can distinguish persons in a team.

All of these codes are already set on the form (either through the registering user's attributes) or via the form itself. The user will not have to enter any of these attributes.

I understand in Microsoft Excel that you can combine 4 different fields by the following

=A1&&A2&&A3&&A4

But is there something similar in YAML code for Webforms?

Thanks!


texts: Is there a function to output the tag and vocabulary?

texts:
$terms = db_query('SELECT vid, name FROM {taxonomy_term_data} WHERE vid=:vid', array(":vid" => 2));

foreach ($terms as $term) {
    echo l($term->name, 'taxonomy/term/'.$term->vid);
}

I want to get all the term under the vocabulary. and the default tag.
If I use the above code to get that, I must know the value of vid, and read the database twice. It's too bad. If someone changes the vocabulary, this will change vid, and my code will not work. Is there a better way to get all the terms in a vocabulary?


texts: Create a module that add text/image to a specific type nodes

texts:
So.
I need to create a module that add something like text, to all my nodes of type "Article" for example.

I need a module that do:
- Find the type of nodes "Article"
- And add a label that says "Made by me ..."
And everytime i see articles, they all have the normal fields (title,body,tag,image) and my label..

Its possible?


texts:
When, for example, I search for Eat & Drink, the search results show &amp; instead of &.

Is there any way to avoid this?


texts: formatter with components and components with modules shows different results

texts:
i want to create a row using views showing an order and separate tax, shipping, total and subtotal.

When I use the formatter 'Formatted Amount With Components' it shows the result in the attached screenshot, like this:
Subtotal: $3.76
Shipping $10.42
Sales Tax $0.99
Order Total $15.17

But when I use commerce price components and check all components (sales tax, base price, discount, fee, shipping, free shipping) it only shows $3.76

If there is another way to display shipping and tax separately I'd appreciate it as well many thanks.


texts:
I am using Composer to download third-party modules to my Drupal 8 repository.

I have a requirement that involves all of the functionality that module gives but there are unfortunately 2 lines of code that I need to remove in a PHP file in the module_name/src/Helper folder.

The lines I've commented out are to stop the request to open a jQuery UI dialog box.

I'm curious as to what you guys think. It is a requirement from the client that I have this functionality in place.

Here is the code snippet taken from the Ajax Add To Cart Module:

namespace Drupal\ajax_add_to_cart\Helper;

use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\ajax_add_to_cart\Ajax\ReloadCommand;
use Drupal\block\Entity\Block;
use Drupal\Core\Ajax\ReplaceCommand;

/**
 * Class AjaxCartHelper.
 *
 * @package Drupal\modules\ajax_add_to_cart
 */
class AjaxCartHelper {

  /**
   * Ajax add to cart response.
   *
   * @param string $form_id
   *   Form id.
   * @param object $response
   *   Response object to store information.
   *
   * @return object
   *   Return response object.
   */
  public function ajaxAddToCartAjaxResponse($form_id, $response) {
    // Adding modal window.
    $options = [
      'width' => 250,
      'height' => 300,
    ];
    $settings = [
      $form_id => [
        'title' => t('Successful Added'),
        'message' => t('Cart Updated Successfully'),
      ],
    ];
    $title = $settings[$form_id]['title'];
    $message = $_SESSION['messages']['status'][0]->__toString();
    if (!empty($this->cartBlock)) {
      // ****LINE TO REMOVE****
      $response->addCommand(new OpenModalDialogCommand($title, $message, $options));
      // **********************
    }
    else {
      $customblock = $this->container->get('plugin.manager.block')->createInstance('commerce_cart', []);
      $render = $customblock->build();
      // ****LINE TO REMOVE****
      $response->addCommand(new OpenModalDialogCommand($title, $render, $options));
      // **********************
    }
    $response->addCommand(new ReplaceCommand('.block-commerce-cart', $this->cartBlock));
    $response->addCommand(new ReloadCommand());
    unset($_SESSION['messages']);
    return $response;
      }
}

I've added the comment - / ****LINE TO REMOVE**** to the lines that need to be removed

My ideas are:

Duplicate the whole module so that it's custom and use that as the solution (even though module updates won't affect the custom module and i'll have to update it each time)
Comment the two lines out and then update the third-party module

Is there any other methods I'm missing? I've seen the libraries override but thats for the purposes of theming purposes- JS and CSS, I just wondered if theres anything out there in the drupal community fro overriding the PHP that modules provide?

It must be a common requirement by Drupal Devs.


texts: Callback to Drupal site after curl call to 3rd party site doesn't resume authenticated session if more than 120 seconds elapsed since authentication

texts:
UPDATED SITUATION:

A user authenticates on my site.
The user selects items to purchase and is sent via curl call (see below) to a payment site.
The payment site does its thing and returns to my site via a callback URL I posted to it. I assume it is also a curl call, since data is posted back.
Upon return, if less than 120 seconds has elapsed since the user originally authenticated on my site, the user's authenticated session is resumed (good).
Upon return, if more than 120 seconds has elapsed since the user originally authenticated on my site, a new session is started (bad). The user is effectively signed out.

This behavior is 100% consistent. I can call the 3rd party site and return any number of times within the 120 second window after authentication and the authenticated session is always resumed. But as soon as I return after 120 seconds, a new session is started.
It doesn't matter whether I authenticate, immediately go to the 3rd party site, and then wait there 120 seconds, or if I authenticate, wait at my site 120 seconds, and then go to the 3rd party site, if the return to my site happens more than 120 seconds after original authentication on my site, a new session is started instead of resuming the authenticated session.
What could cause this? Some kind of timer setting, cache setting, etc.? Maybe a module? I'm asking before I begin the process of disabling modules one by one.
My curl call:
$ch = curl_init('https://commerce.cashnet.com/404Handler/pageredirpost.aspx');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // $data includes the callback URL
curl_exec($ch);
curl_close($ch);
exit;

AN EARLIER VERSION OF THE PROBLEM DESCRIPTION talked about session ids changing, information passed, etc. I removed all that to simplify, as it got too long to leave it in. The original set of comments below are based on that earlier description, which is why they don't seem to make sense now. But they were helpful in guiding me to further testing that revealed the 120-second issue.


texts: Dynamically create a forum and link to an entity content type

texts:
I need to be able to create a forum container and link it to a content type. I tried Node Hierarchy but it only allows forum topics, I need there to be a Forum Container as a child of the content type

Content Type -> Forum Container -> Forum -> Forum Topic

Anybody know how to go about this?


texts:
I just noticed today that my rss feed is not working properly. When I click it, it prompts me to download it.

My site is http://www.sourcecodester.com/

The rss feed url is: http://www.sourcecodester.com/feed

Can anybody tell me what's wrong?


texts: How to get rid of a double breadcrumb in a view

texts:
I have a User view, bringing in nodes via a relationship relating content that references the User in one of the node fields.  I have an attachment to the page, that pulls in content that references the user via another of the node fields.  I also have a block, and an attachment to the block, that pull in the same content.

The issue that I'm having, is that when viewing the page, the title of the view shows up twice in the breadcrumbs, once linked, and once not:

Other views on the site don't have this issue:

I've tried all kind of things, including exporting the view, grepping for all references to menu, deleting them, and reimporting the view to be sure the double breadcrumb wasn't the result of residual menu info from an experiment I made with having tabs in the page instead of an attachment.  I also cleared any references to the view from the menus on the site.  Of course I cleared cache after each of these attempts.  I can't figure out why it seems to think we are viewing a page called Missions to Approve (missions/to-approve) which is a child of page Missions to Approve (missions/to-approve).  Any ideas?


texts: Display different fields based on a URL parameter

texts:
I have a content type called section with 5 custom fields, and I need to display each field as a different page, e.g. section/1/fieldA, section/2/fieldB.

I would like to override node.tpl.php, and output the desired field based on the third parameter (fieldA, fieldB, ...).

How can this be done? Do I need to create a custom module or can be done via theming?

What should I do if I wanted to replace the node ID with a string?


texts: In views, show the number of users who have subscribed to the organic group

texts:
I am using the following modules
1. Organic Groups
2. Views

A content type called Course has been created. It has been set as an organic group.
It has group members(Users who have subscribed to the course).

I have created a view which shows the list of all the groups (Nodes of type Course).
In another column, I want to show the number of users who have subscribed to the group(course).


texts: Adding existing contact form in another page

texts:
There is a contact form in the contact page, which is perfectly working fine.
I want to add the same form in a different page (say product page).
How can I do that in Drupal 8?


texts: How do I remove white space from Bartik?

texts:
I like to move the left hand side further left to remove the white space, as well as move the right hand side towards the right, so that the centre has more space. I like to remove line wrapping with entries and with the majority of my endusers using widescreen monitors it doesn't look that great.

Essentially I like to move the left and right sidebars towards the edges of their respective edges so the centre can become wider. I tried using the inspector and grepping for the relevant CSS code to modify but none of it seems to work.  Nothing else has been modified it is out of the box Bartik theme with no extensions.

Update

.layout-container {

  max-width: 95%;  /* 860px */
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
@media all and (min-width: 95%) {
.layout-container {
max-width: 95%;
 }
}

/**
  * Main
  */
  .layout-main-wrapper {
   min-height: 300px;
  }
 .layout-main {
   margin-top: 20px;
   margin-bottom: 40px;
 }

This works if I edit the /core/themes/bartik/css/layout.css if I copy the theme and place it in the /themes folder it doesnt work.


texts: I would like to add something to my $content variable to add on my node template file, but where is this variable composed? I assume it's in the template.php file but what specific function composes the content of the $content variable?


texts: Content Moderation: how to make a button to move between states?

texts:
I want to allow authenticated users to fill out a node (Draft) and then, when they are ready, submit the node (to give it the Submitted state).  An admin will later decide whether or not to publish the node.

I'm experimenting with the improvements to the Content Moderation module on Drupal 8.4-rc2 (new UI is in the 8.4 series, so 8.3 and before will look different).

I have the following workflow states defined:

Draft
Submitted
Published

There is a transition called Submit to move from the Draft state to the Submitted state.  Authenticated users have permission to use this transition.

The problem is that the core UI for this looks very complicated.

This is a node edit page:

And this is a node view page:

I want to hide this moderation UI and instead provide users with a single button, "Submit for approval."

I hid the moderation and revision UI from auth users (only admin have permission to edit workflows) like this:

function mymodule_form_content_moderation_entity_moderation_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $user = \Drupal::currentUser();
  if ( empty($user) || !($user->hasPermission('administer workflows')) ) {
    $form['#access'] = FALSE;
  }
}

function mymodule_form_node_mycontenttype_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $user = \Drupal::currentUser();
  if ( empty($user) || !($user->hasPermission('administer workflows')) ) {
    $form['revision_information']['#access'] = FALSE;
    $form['moderation_state']['#access'] = FALSE;
  }
}

function mymodule_form_node_mycontenttype_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $user = \Drupal::currentUser();
  if ( empty($user) || !($user->hasPermission('administer workflows')) ) {
    $form['revision_information']['#access'] = FALSE;
    $form['moderation_state']['#access'] = FALSE;
  }
}

So this cleans up the UI and hides all the Content Moderation options.

But how do I create a button to move from one state to another?  Specifically, I want the bottom of the form to look like this:

Save button (saves the node in the same (Draft) workflow state)
New button that saves the node and activates the transition to the Submitted state

This is basically the same thing as what core does when it provides an option to Save as published and a second option to Save as unpublished-- I just want to do this with my workflow states.


texts: Load The Drupal Database Schema in PostgreSQL

texts:
I was following the tutorial in the link below to install Drupal 7 with PostgreSQL.
http://pgedit.com/install_drupal
I'm stuck with step 3.
3.Load the Drupal database schema

Your Drupal installation has a top level folder called 'database' where you will find an installation script called 'database.pgsql'. Simply run the script with psql:

psql -U test_drupal -f /path/to/drupal/database/database.pgsql

In my case I cant find database.pgsql. My database folder only contains files shown in the image below:

|Im using drupal7.34. Where am I possibly missing?


texts: Configuration form and submission handler

texts:
I am using the following code for Drupal 6.

 foreach (variable_get('cleanupeditform_formkeys', 0) as $key => $value ) {
    $form['cleanupedit_hide'][CLEANUPEDITFORM_HIDEPREFIX . $key] = array(
      '#type' => 'checkbox',
      '#title' => t('Hide ') . $value,
      '#default_value' => variable_get(CLEANUPEDITFORM_HIDEPREFIX . $key , 1),
    );
  }

I need to convert this code to Drupal 8.

In buildForm() I generate the form. I need to save the checkboxes values, and I am using the following code.

public function submitForm(array &$form, FormStateInterface $form_state) {
     foreach ((\Drupal::state()->get('cleanupeditform_formkeys') ?: 0) as $key => $value ) {
       parent::submitForm($form,$form_state);
       $this->config('cleanupeditform.admin_settings')
         ->set('element', $form_state['cleanupedit_hide'][CLEANUPEDITFORM_HIDEPREFIX . $key])
         ->set('element', $form_state['cleanupedit_allow'][CLEANUPEDITFORM_ALLOWPREFIX . $key])
         ->save();
     }
     parent::submitForm($form, $form_state);
  }

Please help me to find out a solution.


texts: Views: Link Title using Text URL field (GUID)

texts:
I've created a feed within aggretator that I am displaying using views. I have a title field and a separate GUID field, which contains the link to each specific item's audio podcast. However, when I opt to display the Title as a link, it simply links to the RSS feed's URL. I would like to make it link to the GUID field, which contains that title's audio URL.

How can I use one field in Views to serve as the link of another field?


texts: adding ajax to custom theme for certain form element?

texts:
How do you add ajax to custom theme for certain form element?

I would like to redesign element type radios. I created function to output custom html but now i am stuck with ajax - the javascript for this element is not added.

How do i do that?


texts: How to check if the user is guest in a form

texts: I have a form in a page, so what I want to do is to check wether the user is a guest or a logged user and depending of that add an additional field to a guest, but hide it for the logged user, should this be done in the code of the form or there are some built-in settings for that behaviour?


texts: Drupal database not found after running update.php

texts:
after installing a module I run update.php and then click take me to front page or take me to admin pages the page takes a while to load and eventually gives me the following error:

PDOException: SQLSTATE[HY000] [2002] No route to host in lock_may_be_available() (line 167 of /code/includes/lock.inc).

This seems to happen even if there are no pending updates. There was no changes to settings.php, This also happens if i try and open to many pages to the site at the same time.

the only way to get the site back up and running is to restart the container(Kalabox.)

Any insight on how i can fix this or at least how to trouble shoot it would be great.


texts: Safely enter PHP code in block to prevent site crash?

texts:
When I enter a php snippet into a block (or story or page), it can crash the site.

Two questions:
1) How can the chances of this be reduced? For example, I just crashed a fresh installation because a function name was not recognized. Would placing the code in a try/catch block been likely to prevent that crash?
2) If/when I do crash the site due to malformed php code, how can I recover the site?


texts: Problem assigning group members membership types other than default

texts:
core 7.29
og 7.x-2.x-dev, also tested 7x-2.7

So, I'm going a little crazy trying to get users assigned a membership type other than default in an og.

I can create a new membership type no problem, and add fields. What I can't do for the life of me is find how to assign users to that membership type. The node 1 video made it seem like it shows automatically when adding/editing a user in a group (#overlay=group/node/1/admin/people/add-user), as roles do, but no dice. I realize that video is 2 years old, but it is the most helpful thing I can find on the subject.

Any thoughts/help?

Thanks,

Dan


texts:
I have successfully added the tablesorter.js library to a table in my drupal website but when I try to add the pager, the input and select Html that I add do not show up.  I add this HTML

    <form>

        <input type="text" class="pagedisplay"/>

        <select class="pagesize">
            <option selected="selected"  value="10">10</option>
            <option value="20">20</option>
            <option value="30">30</option>
            <option  value="40">40</option>
        </select>
    </form>

but something in the drupal site makes the select options and the input options disappear from the final page.


texts: Page Not Founds Surfacing in [recent log entries] for all page--customnames.tpl.php

texts:
My custom pages work great and cache fine; however, they trigger "Page not found" in recent log entries.  This does not occur with page--front.tpl.php or any other internal drupal paths.  I am mainly concerned for potintial performance risks which are mitagated through caching but still remain with dynamic pages.

I havent modified template.php or made any other changes besides creating the custom page (404's exist even if I clear the custom page entirly which seems like a configuration issue)

Any pointers would be much appreciated. I am using Drupal 7.14 and am comfortable makeing changes to absolutly everything including httpaccess if required.

Thanks,

-- b


texts: How to add an image upload field to a node programmatically?

texts:
I want to add an image upload field to a node programmatically when the node is being loaded.

I heard that you could use hook_form_alter() but I am looking for better options. Could anyone provide a solution?


texts: Rule to complete checkout for all orders

texts:
How can I create a rule to process checkout for all orders. Te be more specific: I'm creating a shop in which the whole checkout is based on a cronjob. So customers add their products to the shopping cart and every week at friday a cronjob is processed to process all shopping carts and create a order for them. Payment is not necessary, and users can not manually complete orders.

I've tried to create this in rules, but their is only the option to "Complete checkout for an order" not all orders.


texts:
I am in little situation while creating D8 views. My scenario:

I have two Content Types:

Page, with fields:

title
teaser

Article, with fields:

name
reference_page (article have unlimited reference field for)

I want output in each ROW like:

title (from Page), teaser (from Page) and name of each Article where Page appears.

I am getting duplicate Page fields for each existence of page in Article.

Any suggestions?


texts: Best approach for creating databases for sub-sites

texts: I have to create a website that has about 1000(in future thousands) sub-sites. How should I create database for this sub-sites? Creating a separate database per site, or creating for example 10 databases, each one for 100 sites(using table prefixes), or ...?


texts: Pressflow Install - Redirect to database configuration without error

texts:
I am currently installing the database in the conguration distribution "Pressflow." I have already installed apc and varnish.

During installation, I put the access to the database and when I click OK, I am automatically redirected to the same page. This does not create the database


texts:
Having 3 different view , I'm going to show them in a page as different tabs.
All of these views have exposed filter and are not completely related (one view shows users , one shows content and the last one shows taxonomy terms).
I changed the menu types in these views to menu tab and their address to "seek/VIEWNAME".

now trying to browse seek I face 404 error and browsing "seek/users" I only get the "user" view without any tabs to other views.

How can create a tab consisting menus to different views?


texts: How to use a field as an entity's property

texts:
My module provides its own entity. I need my entity to have a link field with multiple values. The module link is suitable for this. At install hook, I create a field and a field instance of link type.

But at entity's fields management page, this field looks like a regular filed, that can be deleted by user. But I need this field to be a hard part of my entity, as a property. How can I make this?

This case is not exactly about link field, but generally of creating entity's properties of field types.


texts: How to pass a field value as contextual filter argument using Twig Tweak drupal_view?

texts:
In Drupal 8, I'm using Twig Tweak to embed a view. I have a contextual filter set to one of the node's fields, field_project_id. If I use a literal for the third argument, it works. If I try to reference the value of the current node's project ID, no luck.

Works:

{{ drupal_view('my_view', 'block_1', '2011-40054-000') }}

Doesn't work:

{{ drupal_view('my_view', 'block_1', content.field_project_id) }},
{{ drupal_view('my_view', 'block_1', content.field_project_id.value) }},
{{ drupal_view('my_view', 'block_1', content.field_project_id.0) }},
{{ drupal_view('my_view', 'block_1', content.field_project_id.0.value) }},

etc.

What's the proper way to do this?


texts:
I have a customer who requires the correct set of responsive classes for his block in a given theme depending on its position and count. In my theme_preprocess_page(&$vars) I can identify the blocks in this region and build up an array for each block using its plugin_id and save it to $variables['highlighted'].

In my page.html.twig I use {{ highlighted }} and the array shows up wonderfully. Because block.html.twig by default is set up to be looking for {{ plugin_id }} I expected that I can test if plugin_id is in_array() and add these classes to that instance of the block.

But {{ highlighted }} in block.html.twig returns null in this theme, suggesting that $variables['page'] works for the page, but not block?
Twig has a way to pass off variables to an arbitrary twig file but I do not know how to do this in Drupal. For instance, my page.html.twig is using {{ highlighted }} to pull in these blocks from $variables.

So my question is how does Drupal 8's adaptation the Twig source determine which variables are passed (plugin_id, content, attributes, id, etc) and how I can add mine? I've looked through the twig.engine and searched the Twig source, but it's not clear to me which class controls what variables are passed to blocks?
My other avenue is to find a way to pass this array of classes to theme_preprocess_block but every attempt I made to try this ends up with theme_preprocess_block returning NULL for this array, suggesting that preprocess_page() and preprocess_block() are working separtely.


texts: How to install Drupal without interaction via web UI?

texts: Is it possible to confgirue installation profile so it can be installed via web UI as usual but without any interaction, just the progress bar?


texts: Trying to get a node over REST says 'Not acceptable format: json'

texts:
(Yes there are other questions the same as this, but they're older versions and the solutions there don't work.)
I have this REST resource config rest.resource.entity.node.yml:
uuid: 248f9825-289c-4201-9f5b-a8d63cf2e5ca
langcode: en
status: true
dependencies:
  module:
    - basic_auth
    - hal
    - node
    - serialization
_core:
  default_config_hash: t_jfECmZhJqBOJuSOFn87EOi_TWi-_fRYTuJgd19vgg
id: entity.node
plugin_id: 'entity:node'
granularity: resource
configuration:
  methods:
    - GET
    - POST
    - DELETE
    - PATCH
  formats:
    - hal_json
    - json
  authentication:
    - basic_auth

When I go to /node/123?_format=json, I get:
 {"message":"Not acceptable format: json"}

I don't understand what's going wrong.
I can see the rest.entity.node.GET route in the {router} DB table. The _format property for that says 'webapp_json' rather than 'json'. Is that normal?
The full route definition from the DB is:
C:31:"Symfony\Component\Routing\Route":1467:{a:9:{s:4:"path";s:12:"/node/{node}";s:4:"host";s:0:"";s:8:"defaults";a:2:{s:11:"_controller";s:34:"Drupal\rest\RequestHandler::handle";s:21:"_rest_resource_config";s:6:"webapp";}s:12:"requirements";a:4:{s:7:"_access";s:4:"TRUE";s:14:"_entity_access";s:9:"node.view";s:26:"_csrf_request_header_token";s:4:"TRUE";s:7:"_format";s:11:"webapp_json";}s:7:"options";a:5:{s:14:"compiler_class";s:33:"Drupal\Core\Routing\RouteCompiler";s:10:"parameters";a:2:{s:4:"node";a:2:{s:4:"type";s:11:"entity:node";s:9:"converter";s:30:"paramconverter.latest_revision";}s:21:"_rest_resource_config";a:2:{s:4:"type";s:27:"entity:rest_resource_config";s:9:"converter";s:30:"paramconverter.latest_revision";}}s:5:"_auth";a:2:{i:0;s:10:"basic_auth";i:1;s:6:"cookie";}s:14:"_access_checks";a:3:{i:0;s:20:"access_check.default";i:1;s:19:"access_check.entity";i:2;s:24:"access_check.header.csrf";}s:4:"utf8";b:1;}s:7:"schemes";a:0:{}s:7:"methods";a:1:{i:0;s:3:"GET";}s:9:"condition";s:0:"";s:8:"compiled";C:33:"Drupal\Core\Routing\CompiledRoute":440:{a:11:{s:4:"vars";a:1:{i:0;s:4:"node";}s:11:"path_prefix";s:0:"";s:10:"path_regex";s:29:"#^/node/(?P<node>[^/]++)$#sDu";s:11:"path_tokens";a:2:{i:0;a:5:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:6:"[^/]++";i:3;s:4:"node";i:4;b:1;}i:1;a:2:{i:0;s:4:"text";i:1;s:5:"/node";}}s:9:"path_vars";a:1:{i:0;s:4:"node";}s:10:"host_regex";N;s:11:"host_tokens";a:0:{}s:9:"host_vars";a:0:{}s:3:"fit";i:2;s:14:"patternOutline";s:7:"/node/%";s:8:"numParts";i:2;}}}}


texts: Update remaining points in different site once purchase through points method

texts:
I am using userpoints module. What I need to do is once the purchase is done through points methos, update the remaining points in different drupal site.

I have tried for webservices. I have created web services which will update the remaining points in other site.

I have gone through the code and found function uc_userpoints_payment_uc_order() 'all\modules\userpoints_ubercart\uc_userpoints_payment\uc_userpoints_payment.module' where it updates (uc_userpoints_payment_payment) or refund the points (uc_userpoints_payment_refund). So here (in these two functions), I want to call webservice.

Could anyone please throw some light and point me in right direction?


texts: Drupal 7: Webform Emails: How to change content based on a condition?

texts:
I have a webform and I want to send email on submission to this form.

Currently, I configured the emails and its working fine. However, I would like to put conditions on sending the email.
Like if field_1 = "xyz" then change the email content to "abcd"
     else change email content to "pqrs"

Can this be done using the inbuilt module for emails?
Please help


texts:
I am trying to reload the .services.yml file of a custom module without having to reinstall the module.

Is there a Drush command or another way to achieve this?
Does drush cr also clear the services.yml files information? It's really hard for me to tell.


texts: I've got some rules sending email messages to users. The content of the email is defined in a field in a 'send mail' action and I were wondering if it's possible to use wysiwyg there?


texts: WHERE can I change the notification email message for role assigments?

texts:
I'm using Ubercart 2 and Drupal 6 and I cannot find the place where I can change/customize the notification email that's sent out for new and/or expiring role assignments.
Here is the generic message:

The role, member, you acquired by purchasing a product at our store has expired. Any special access or privileges that came with it are now gone. You can purchase it again by going to MY WEBSITE
Thanks again,
MY WEBSITE

I've looked under conditional actions, and while that helps me understand how and when emails are sent I cannot change the message text from there. Neither can I change the message text in admin/store/settings/checkout/edit/messages.


texts: Custom redirect after "admin create user"

texts:
For usability of the system when a admin role creates a new user. The admin wants to edit user details but to do this he/she now needs to go to the user and click on "Edit" first.

Is there a way to redirect to this created user's "Edit" page immediately after creating that user?

Thanks in advance!


texts:
I am using OG module for creating a group. Based on the group we made the functionality of adding a member, discussion based on the created group. I have a link with subscribing a member for my created group. I have doubt with how to show the added member in the front end group list. Please suggest me some ideas.

Thank you,
Sathish


texts: Can I use the prepopulate module on an entityreference field in an entityform?

texts:
It may be wishful dreaming, but it would be sweet if I could pull this off.  I've been banging my head against it for a while now.

Has anyone done this before?


texts: How do I use an image as term reference in Drupal 7 and Commerce Kickstart?

texts:
I want to display a list of fruits in flavours taxonomy. I can easily display the term as term reference but I want an image (specifically the taxonomy image) as the list and clicking the image of the taxonomy the main image of the product should change, i.e. when clicked in strawberry it should show up strawberry cake.

Its term reference is working perfectly fine but I just want the images in place of text.
I have done with color and it works fine.  In other words I need a solution for how to display taxonomy image in the same way as they display color in Commerce Kickstart.


texts:
I have been playing with the Services module for a couple of days. According to general REST API best practices, the GET URL paths I should use are:

/buildings
/buildings/4
/buildings/4/rooms
/buildings/4/rooms/5

..where in my Drupal site 'Building' and 'room' are both content types, and '4' and '5', the node-ids.

Using the Services module, I can create the following calls:

/node/type=building
/node/4

And with the Services Views module, I can customize the path a little more:

/buildings

But the only way to get a specific building is by:

/buildings?nid=4

In order to enable the call path /buildings/4 do I have to create a custom Services resource?


texts: Optionally redirect a content to another url?

texts:
I'm using drupal 7.  I have a content type called News Item.   On my home page, I have a block+view that lists the most recent news items.  What is shown is the title of the news item, a brief description, and a read more link to the news item.   When a person clicks on the read more link, it takes them to a page that displays the entire news item.

I want the ability to specify a redirect on some news items.  If a news item has a redirect, whenever a person clicks on the read more link in the home page, they will be redirected to a different url, NOT the url of the actual news item.  And if a person types in the url of the actual news item, they will be redirected to the different url instead.

How do I implement this kind of functionality?


texts: D7: How can I list duplicate entities based on the entity title and bundle, without custom coding

texts:
There is a module for removing duplicate nodes, but how to delete duplicate entities (in my case ECK entities) based on title and bundle that are the same?

I was thinking that the search api module might be of help, which I installed. But listing duplicates requires something extra.

I also have Rules installed, but not sure how to create such rule.

What would be a recommended way to do this?


texts: Can I use Plain PHP functions in tpl file?

texts:
I have a tpl.php page for login form in my drupal site in which have 4 images.

I need to display only one of these 4 images randomly on each page load.

I can easily do this in less than 10 lines of code using the php rand() function.

But is it advisable to directly use such functions in tpl files.
Could this have some sort of security risk?

UPDATE:

The 4 images that I talked about. I have just uploaded them to sites/default/files/images folder and have included them in tpl file using following code:

<img src="http://mysite.com/sites/default/files/images/image.jpg"/>

I have a feeling that this is unsafe too. Please advise.


texts: how to add my custom template of heatbeat

texts:
d7+heratbeat version = "7.x-1.1"

I have a module named "love.module"
in love.module

/**
 * Implement hook_ctools_plugin_api().
 *
 * This hook is needed to let ctools know about exportables.
 * @see heartbeat_og_ctools_plugin_api
 */
function love_ctools_plugin_api($module, $api) {
  if ($module == 'love' && $api == 'love') {
    return array('version' => 1);
  }
}

and I have a file name love.heartbeat.inc,

    <?php
/**
 * Implements hook_heartbeat_template_info().
 */
function love_heartbeat_template_info() {
  watchdog('-call', 'message', array(), WATCHDOG_NOTICE, 'link');
$heartbeatmessagetemplate = new HeartbeatMessageTemplate();
$heartbeatmessagetemplate->disabled = FALSE; /* Edit this to true to make a default heartbeatmessagetemplate disabled initially */
$heartbeatmessagetemplate->api_version = 1;
$heartbeatmessagetemplate->message_id = 'heartbeat_add_comment2';
$heartbeatmessagetemplate->description = 'user replied on some content';
$heartbeatmessagetemplate->message = '!username replied on !title:

!comment

';
$heartbeatmessagetemplate->message_concat = '%username% replied on !title.';
$heartbeatmessagetemplate->perms = 2;
$heartbeatmessagetemplate->group_type = 'summary';
$heartbeatmessagetemplate->concat_args = array(
  'group_by' => 'node',
  'group_target' => 'username',
  'group_by_target' => 'title',
  'group_num_max' => '5',
  'merge_separator' => ', ',
  'merge_end_separator' => ' and ',
  'roles' => array(
    1 => 0,
    2 => 0,
    3 => 0,
    4 => 0,
    5 => 0,
  ),
);
$heartbeatmessagetemplate->variables = array(
  '!username' => '',
  '!title' => '',
  '!comment' => '',
);
$heartbeatmessagetemplate->attachments = array(
  'buttons' => array(
    'weight' => array(
      'activitycomments' => '-9',
      'flagattachment:like' => '0',
    ),
    'settings' => array(
      'activitycomments' => array(
        'activitycomments_node' => 0,
      ),
    ),
    'enabled' => array(
      'activitycomments' => 0,
      'flagattachment:like' => 0,
    ),
  ),
  'content' => array(
    'weight' => array(
      'activitycomments' => '-9',
      'flagattachment:like' => '0',
    ),
    'enabled' => array(
      'activitycomments' => 0,
      'flagattachment:like' => 0,
    ),
  ),
);

  return $heartbeatmessagetemplate;
}

but the hook didn't called.who can help me?
did I miss somthing?


texts:
I'm having problems with some links that have a user token in it.

For ex. I have a link like this: user/[current-user:uid]/edit.
But when I check this in the browser as a user I just see Edit instead of my Menu link title. I also get this error:

  Notice: Undefined index: localized_options in menu_navigation_links() (line 1861 of /includes/menu.inc).

When I check this is as an admin I see the correct title and no error.

When I change permissions of Administer users and set to all users I can see it as a user to, but that's not the way to do it because now a user can cancel his account and change the role ... .

In my search quest I've found this issue but the solution #2 didn't help much.

I'm using the Menu Token Module and these are my configurations (user is set as you can see):

These are my link configurations:

As you can see I tried the solution from the issue on drupal.org.


texts: Custom module implementation for menu items as JSON

texts:
Through the use of a Drupal 8 custom module for the purpose of providing the menu items/menu structure as a JSON resource, I have encountered a problem which I'm hoping someone will have an answer or lead for.

The output to the extent that it's currently functioning appears in JSON format, the structure following the same as the defacto menu system outputting title, weight, and whether the item is active.

    [
  {
    "title": "Vehicles",
    "url": {},
    "weight": "1",
    "active": true
  },
  {
    "title": "Automotive Parts",
    "url": {},
    "weight": "2",
    "active": true
  },

The URL is not displayed, even though in Drupal there are paths entered for the items. I have made several attempts at browsing the Drupal 8 documentation to search for answers about URL and menu classes. Currently, the relevant code responsible for the output is this one.

public function get($entity) {
$menu_name = $entity;
$menu_parameters = \Drupal::menuTree()->getCurrentRouteMenuTreeParameters($menu_name);
$tree = \Drupal::menuTree()->load($menu_name, $menu_parameters);
$result = array();

foreach ($tree as $element) {
  $link = $element->link;

  // if ($link->getUrlObject()->isExternal() == true) {
  //   $route = $link->getUrlObject();
  // }
  // else {
  //   // $route = $link->getUrlObject()->getInternalPath(); //this is breaking the module because apparently there are no "internal routes".
  // }
  dpm($link->getUrlObject());
  if ($link->isEnabled() == true) {
     array_push($result, array(
      'title' => $link->getTitle(),
      'url' => Url::fromUri($link->getUrlObject()->toUriString()),
      'weight' => $link->getWeight(),
      'active' => $link->isEnabled()
    )
  );
 }
}
return new JsonResponse($result);

}

How can I make the 'url' => part of the code output the path entered in Drupal for that menu item?


texts: Which module for responsive images without Apache?

texts:
Possible Duplicate:
  Handling Mobile Images in Responsive Drupal 7 Theme

I'm searching a good module to manage responsive images.

My site is build with Omega theme and the site will be published on a server that doesn't use Apache, so I can use modules that use .htaccess.

Which module do you suggest for my case?


texts: Pathauto changing drupal_get_path file path

texts:
Pathauto changed where drupal_get_path looks for an image path I'm calling.

<img src="<?php print drupal_get_path('theme', 'maafs_subpage'); ?>/images/iafe.jpg" alt="Iafe the Network">

This was accessing http://localhost/maafs/sites/all/themes/maafs_subpage/images/iafe.jpg

Now it's trying to access http://localhost/maafs/news/sites/all/themes/maafs_subpage/images/iafe.jpg

Is there a work around for this or is there a better way of getting the path for the image?

Thanks in advance for your help.


texts:
Background

I've built a custom entity using the drupal console, which was kind enough to implement an instance of EntityViewsData for my entity, called MyEntityViewsData.

In the call to MyEntityViewsData::getViewsData(), I have successfully registered a dynamic field, which I then implemented by extending FieldPluginBase. This works as intended.

I then tried the same approach to implement sorting for this field (this time extending SortPluginBase), but have not had any success. I also tried just using the Standard (Drupal\views\Plugin\views\field\Standard) sort plugin. But every attempt results in a SQL error that the sort field does not exist.

The question

How do I sort a dynamic field in Views?

Code

src/Entity/MyEntityViewsData.php

class MyEntityViewsData extends EntityViewsData implements EntityViewsDataInterface {

  /**
   * {@inheritdoc}
   */
  public function getViewsData() {
    $data = parent::getViewsData();
    $table = &$data['myentity_field_data'];
    $table['display_name'] = [
      'title' => $this->t('Display name'),
      'field' => [
        'title' => $this->t('Display name'),
        'help' => $this->t('Displays the entity's Short Name if available, or the Name otherwise.'),
        'id' => 'myentity_display_name_field',
      ],

     'sort' => [

        // Results in SQL error...
        'title' => $this->t('Display name'),
        'help' => $this->t('Sorts entities by display name.'),
        'id' => 'myentity_display_name_sort',

        // Also results in SQL error.
        'field' => 'display_name',
        'id' => 'standard',
      ]
    ];
    return $data;
  }

}

src/Plugin/views/field/MyEntityDisplayNameField.php

/**
 * @ViewsField("myentity_display_name_field");
 */
class MyEntityDisplayNameField extends FieldPluginBase {
  public function query() {
    // Nothing to return.
  }

  public function render(ResultRow $values) {
    $my_entity = $this->getEntity($values);
    return $my_entity->getDisplayName();
  }
}

src/Plugin/views/sort/MyEntityDisplayNameSort.php

/**
 * @ViewsSort("myentity_display_name_sort")
 */
class MyEntityDisplayNameSort extends SortPluginBase {
  public function query() {
    $this->ensureMyTable();

    // This results in an error...
    $this->query->addOrderBy(NULL, "{$this->tableAlias}.{$this->realField}", $this->options['order'], $this->tableAlias.'_display_name_sort');

    // As does this.
    $this->query->orderby[] = [
      'field' => "{$this->tableAlias}.{$this->realField}",
      'direction' => $this->options['order'],
    ];
  }
}


texts:
I am new to ajax so my question might be a basic one, but I have not found an answer anywhere so I ask here.
I am building eshop website on D7 with Commerce. On page where products are displayed I have 2 custom php scripts included - one that echoes menu(filter) and one that echoes products. The menu is implemented as a filter, users can select multiple checkboxes to display multiple categories of products. These categories are passed in URL, for example /eshop?filter=category1+category2. There are about 20 products in each category, but because user can select a lot of categories, there can be quite a lot of products to fetch from db and the page load is slow. So I would like to ajaxify this process so the behavior is like this: display whole page, including menu. Display loading gif for each category while it is fetched from the database. When data are ready, display the category(replace loading gif) and continue with the next category, until all categories are displayed.
function loadCategory(filter){

if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {
        // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status==200) {
            document.getElementById(filter).innerHTML = xmlhttp.responseText;

        }
    }
    xmlhttp.open("GET","my_php_file.php?filter="+filter,true);
    xmlhttp.send(null);
}

I am calling the above function(taken from w3schools) on jQuery(document).ready() event multiple times for each category(filter) and it works fine. The problem is that in my_php_file.php I need to have access to drupal functions - not only db_query(), but also some commerce functions since I am building custom add to cart forms. I have tried bootstraping drupal as hinted here, but it does not work as drupal shows site telling me that drupal is already installed.
How do I achieve this? Or am I taking wrong approach? Thanks a lot.


texts: Hiding a tab on a user profile based on the user role

texts:
I'm making a site using Drupal 8 and I have several roles defined, one of them is Writer. I made a view to show as a tab in the user profile pages called Backlist. If the user is a writer, they can add a list of their books they have written. Everyone visiting the site has access to the backlist information under that tab. What I'm trying to do is make it so the tab ONLY shows in profiles that are writers.
This is very similar to this question: Hide views tab display on user profile to profile owner
That answer didn't work for me because it seems that the 'hide view' is no longer in the validation settings.
As I have it now, the tab shows all the time, and if there's no content, it just shows a message.
So is it possible to hide a views tab, in a profile, based on the owner's role?
Contextual filters:

Configure contextual filter: User: User ID
validation criteria: User_ID
Restrict user based on role: Writer
Action to take if filter value does not validate: Display Contents of No results found


texts: Webform clone translation and caching issue

texts:
when i clone a webform programmatically i loose the translation.
This is my code.

//Load webform to duplicate
  $webform = \Drupal::entityTypeManager()->getStorage('webform')->load($default_template);

  //Create duplicate
  $webform_duplicate = $webform->createDuplicate();

  $webform_duplicate->set('id',$id);
  $webform_duplicate->set('title',$title);
  // $webform_duplicate->set('langcode','en');
  $webform_duplicate->set('description','Event Registration GR Form for '.$title);

  //Save duplicate
  $webform_duplicate->save();
?>

Webform is created with out any problems but there is no translation and when i check in the config db table there is nothing there too.
When i search for the template i can see that there is a config row-record / collection : language.el that corresponds to the translated version of the default template.
I tried to add programmatically a translation with this code

  $result = \Drupal::database()->select('config', 'c')
  ->fields('c', ['collection', 'name', 'data'])
  ->condition('c.name', 'webform.webform.event_registration_gr')
  ->condition('c.collection', 'language.el', 'LIKE')
  ->execute();

  while ($record = $result->fetchAssoc()) {
    $record['name'] = 'webform.webform.' . $webform_duplicate->id();
    \Drupal::database()->insert('config')
      ->fields(['collection', 'name', 'data'])
      ->values($record)
      ->execute();
  }

Which works fine too but there is an important issue with caches.
If i do not run drush cr there is no translation for my webform.
What am i missing here?
Please can you help?
Thank you in advance!


texts: How to determine if request will result in a successful HTTP request?

texts:
Two part question here.

What is the proper way in a module to determine if a page request is resulting in a HTTP 200 OK?  Looking through static $stored_headers for a 30x/40x/50x seems wrong.

What is the earliest hook that you can reliably do this from?


texts: Get id of an organic group inside a view

texts:
How can i get the organic group id inside a view?
I tried to get it like this:

function HOOK_preprocess_views_view(&$vars) {
  if ($vars['view']->name == 'MYVIEWSNAME') {
    $nid = $vars['view']->result[0]->nid;
    $node = node_load($nid);
    $og_id = $node->og_group_ref['und'][0]['target_id'];
    dpm($og_id);
  }
}

This is printing the correct id to my devel debug,
but i cant access $og_id in my view-template.

Or maybe you got an other solution to create the /node/add/document .. link.


texts: country based product price should be changed in commerce kickstart?

texts:
I have installed commerce kickstart. I have to add the two prices for single product.

  If Indian subscribers view the site means product price should display as
  2000 INR.

  If other users visit the site means product price should display as $ 50.

How to identify the user whether view the site in India and other country and how to change the price also ? Anyone guide to me? Based on country how can i change the price also?


texts: I can't turn off/pause automatic slideshow when there is only 1 picture (using lightbox2)

texts:
I am using lightbox2 and it is a wonderful module. The only issue that I have is that I cannot seem to find a way to turn off the automatic diashow when there is only 1 picture.

When 5 pictures are added to a blogmessage there is a slideshow, 1 by 1 the pictures are shown. This can be paused in case someone wants to have a longer look at a picture.
When there is only 1 picture it is not possible to pause. It is possible but I have to configure a button, standard is Space button. But my users do not know this. How can achieve this without a keyboard key?

What I want:
I want to make sure that when there is only 1 picture it can also be paused. So you don't have to click on the thumbnail of the picture again to see it in deatil.

I hope that is somewhat clear.
Thanks in advance!


texts: Can't find the "Create prev/next controls" option

texts:
I created a slideshow using the Field slideshow module. However, I can't find the Create prev/next controls. Any tips on where they are located?

Oh, and I can't see the "Slideshow" option under Format in the Manage Display window for the newly created content type of Slideshow...


texts: How to create a simple shopping cart without Drupal Commerce or Ubercart?

texts:
I want to make a simple order web site for selling some poster. I don't need to add to basket or complicated order stuff. I need only list my posters in catalog view and when clicked one of them appear detail about poster. And in the detailed page I need an order button and then order form.

What is the best way for this? I mean I use Views for catalog and detail page. My question is How to configure when user click an catalog item and the user goes to detailed page with created views?


texts:
I have created a custom module which opens modal with a specific Url Pattern. I'm using the url in a view and it works well.

The only problem is that I also load another piece of jQuery to create a basic accordion which breaks after the modal has been loaded. The javascript is still called but it toggles twice instead of once.

/**
 *  Implements of hook_menu()
 */
function mymodule_menu() {
  $items['modals/%ctools_js/%'] = array(
      'title' => 'Product Modal',
      'page arguments' => array(1, 2),
      'page callback' => 'mymodule_modal_page',
      'access callback' => TRUE,
      'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}
/**
 * A modal static page callback.
 * @param $js
 *   boolean CTools determination whether the user's browser is javascript enabled.
 * @param $nid
 *   string The node ID of passed as an argument from the hook_menu() path
 * @return
 *   string The contents of the node, that will fill the modal window.
 */
function mymodule_modal_page($js = NULL, $nid = NULL) {
  if ($nid == NULL) {
    return 'No node id was sent. Error.';
  }
  if ($js) {
    ctools_include('modal');
    ctools_include('ajax');

  }
  $node = node_load($nid);
  $contents = render(node_view($node, 'modal', NULL));
  return ctools_modal_render($node->title, $contents) ;
}

  /**
   * Implements hook_views_pre_render()
   */
  function mymodule_views_pre_render(&$views) {
    if ($views->name == 'my_view') {
      //add accordion script
        ctools_include('ajax');
        ctools_include('modal');
        ctools_modal_add_js();

        $product_style = array(
          'product-modal-style' => array(
            'modalSize' => array(
              'type' => 'fixed',
              'width' => 400,
              'height' => 400,
              'addWidth' => 10,
              'addHeight' => 10,
              'contentRight' => 1,
              'contentBottom' => 1,
            ),
            'modalOptions' => array(
              'opacity' => .9,
              'background-color' => '#424242',
            ),
            'animation' => 'fadeIn',
            'modalTheme' => 'product_modal',
          ),
        );
      drupal_add_js($product_style, 'setting');
      ctools_add_js('product', 'mymodule');
      ctools_add_css('product', 'mymodule');
      drupal_add_js(drupal_get_path('module', 'ukgproducts') . '/js/product_accordion.js','file');
    }
  }
  }

  /**
  * Implements hook_theme().
  */
  function ukgproducts_theme() {
    return array(
      'views_view_unformatted__my_view' => array(
        'variables' => array('view' => NULL, 'options' => NULL, 'row' => NULL),
        'template' => 'views-view-unformatted--my_view',
        'base hook' => 'views_view_unformatted',
        'path' => drupal_get_path('module', 'mymodule') . '/theme',
      ),
    );
  }

accordion JS

(function($, Drupal)
{
  // Drupal.behaviors is the Drupal onload function:
  Drupal.behaviors.ukgproducts = {
    attach:function()
    {
      $('h2').click(function(e)
      {
        e.preventDefault();
        $(this).closest('.binder').find('.product-list').toggle('slow');
      });
    }
  }
}(jQuery, Drupal));


texts: How to show album title for 'album with no photos' in view

texts: I am using node gallery module to create albums and upload photos. I have created a view to create albums and upload photos.It is working fine.But when i create album with no photos, album title is not getting displayed.I want to show 'default image and title of the album' for 'albums with no photos'.I have specified 'title and default image' in 'content:photo' no result behaviour in my view and Only the node author can see this but other users are not able to view this album. How to do this?


texts:
I have to embed a contact form inside of a block, and I'm trying to use the entity.form_builder service, But I'm not sure which entity I should give it, I found Message and ContactForm entity, so what I'm thinking is to create a contact form entity and give it to the entityFormBuilder->getForm($contactFormEntity)

My current code is:

<?php

/**
 * @file
 * Contains Drupal\pid_contactform_block\Plugin\Block\TellUsYourStoryBlock
 */

namespace Drupal\pid_contactform_block\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Class TellUsYourStoryBlock
 * @package Drupal\pid_contactform_block\Plugin\Block
 * @Block(
 *     id = "tell_us_your_story_block_id",
 *     admin_label = "Tell us your story block",
 *     module = "pid_contactform_block"
 * )
 */
class TellUsYourStoryBlock extends BlockBase implements ContainerFactoryPluginInterface {
    protected $entityFormBuilder;

public function __construct(array $configuration, $plugin_id, $plugin_definition, $entityFormBuilder) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityFormBuilder = $entityFormBuilder;
}
/**
 * Builds and returns the renderable array for this block plugin.
 *
 * If a block should not be rendered because it has no content, then this
 * method must also ensure to return no content: it must then only return an
 * empty array, or an empty array with #cache set (with cacheability metadata
 * indicating the circumstances for it being empty).
 *
 * @return array
 *   A renderable array representing the content of the block.
 *
 * @see \Drupal\block\BlockViewBuilder
 */
public function build()
{
    return $this->entityFormBuilder->getForm();

}

/**
 * Creates an instance of the plugin.
 *
 * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
 *   The container to pull out services used in the plugin.
 * @param array $configuration
 *   A configuration array containing information about the plugin instance.
 * @param string $plugin_id
 *   The plugin ID for the plugin instance.
 * @param mixed $plugin_definition
 *   The plugin implementation definition.
 *
 * @return static
 *   Returns an instance of this plugin.
 */
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
{
    return new static(
        $configuration,
        $plugin_id,
        $plugin_definition,
        $container->get('entity.form_builder')
    );
}

}

My question is basically:

Am i doing it the right way?
How do I initialize the ContactForm entity correctly, if I am right, should I just import it or should I require it through a service or something?
If I'm not right, do you have any idea how I should do it then?


texts: Views Geolocation field proximity: How to alter views field setting

texts:
I'm using a Geolocation field in views to order results by distance. The module provides a special views proximity plugin/field, which can be used in the "sort" section of the view. This plugin/field has a "proximity setting" (lat/long) to define the center point for distance calculation. I got this far in views UI and this all works.

I now need to programmatically change that center point based on a custom logic derived from the current user, but I don't know which views hook to use to alter this field setting.

Tried, didn't work:

function MYMODULE_views_pre_view($view, $display_id, &$args) {
  //my field's machine name is "field_geo"
  $geoField = $view->display_handler->getHandler('field', 'field_geo_proximity');
  //print_r($geofield) is empty

  //suffix "_proximity" seems to be added by geolocation module, but does not work either
  $geoFieldProximity = $view->display_handler->getHandler('field', 'field_geo_proximity');
  //print_r($geofieldProximity) is empty
}

I've got two questions:

Is pre_view the correct hook to alter the field setting? (If not, which hook should I use instead?)
How to I get/set those field settings?
I thought I need to use $view->display_handler->getHandler() but didn't get any results.


texts: Programmatically render menu on search view

texts:
I'm trying to programmatically build a menu on my site, it works fine on all pages except a search view. This code I'm using is below:

        $config = array('menu_name' => $menu_name, 'level' => 2, 'depth' => 10, 'expanded' => true);
        $menu_tree = menu_tree_build($config);

When I do a var_dump() of $menu_tree it has a content key in the array which has all the menu items, but only if the page is a 'normal' node. If it's the search results view then that array key is empty.

Does anyone have any idea why this is?

I also have two custom functions to change the output of the menu however these don't seem to be called as if I do a var_dump("test") at the start of them it has no affect. The two custom methods are:

THEME_menu_tree__menu_footer_links_1()
THEME_menu_link__menu_footer_links_1()


texts: Keep Footer at the Bottom of the Page w/ Andromeda Theme

texts: I recently setup a site using the Andromeda theme and love it! However the only issue I have is that when a page doesn't have much content in it the footer does not stick to the bottom of the page. I have tried to implement some of the css answers I have seen on this site with no luck. Does anyone else know how to implement this?


texts: Link Field removing parameters for external links

texts:
I have a content type which uses the link field which I have set to external URLs only. When I put a website URL with more than 1 query in it, it won't render the second portion of the query at all.

Example of what should render:

https://example.com/login.aspx?inst=name&url=http://example2.com/PlayLists.aspx?aid=8674

Ends up rendering as:

https://example.com/login.aspx?inst=name&url=http://example2.com/PlayLists.aspx

Removing the last ?aid=8674

I've tried setting the field setting to use Both internal and external links as mentioned in this similar question, however, this did not solve anything for me. Any time there is more than 1 query with the URL, it removes everything except the first one.

Would anyone have come across this before or know of a way to solve this? For this particular content type, we link users to external sites and they need these URL's to authenticate through the multiple parameters we set in the link field.


texts:
I have a Drupal website where many custom modules are implemented. These modules create custom rendered pages which are linked to menu items. This way a menu item represents a custom rendered page. Some other menu items are linked to node instances.

My goal is to provide meta data to each of these menu items. The meta data I want to add to each menu item are 'page description', 'user notes' and eventually term references (taxonomy).

Is there a way to add meta data to each of my menu items?

One possible solution I can come up with is creating a content type that wraps custom rendered pages with a 'description', 'user notes' and 'tags' field. Then I would create a node for each of my custom rendered pages and link the nodes to the menu items. But I'm wondering if there aren't more elegant solutions..


texts: We have a field collection containing an image and three different Text fields. How can we open the whole field collection (= all four fields (= image + texts)) within the colorbox??? The module colorbox-node does not help because we don't have separate nodes (and no URL-pathes to the content).


texts: How to add security questions in Drupal 8?

texts:
I need to add security questions while user creating his account in Drupal 8. I need to use those security questions to retrieve his password, when user forgets his password.

Any suggestions ?


texts: If I have added extra fields to a user profile, how can I programmatically check if those fields are empty?

texts: I have added some fields to my user entity, (doing this in hook_install(), in .install file). This is in a custom module. If I uninstall this custom module I only want to uninstall those fields if users don't have any values for the field, so I don't end up losing data from my users. How can I check fields of a user?


texts: how to create signup form with MailChimp module

texts: I want to follow the tutorial at https://drupalize.me/videos/create-your-first-mailing-list-and-sign-form?p=2235 but I'm stumbling as soon as we get to create sign up forms in the MailChimp module configuration. I don't see a "SIGNUP FORMS" tab but instead I get 5 red error messages on top that say Failed to load MailChimp PHP library. Please refer to the installation requirements. and if I look under /admin/reports/status, I see The MailChimp MCAPI library could not be found. under the MailChimp module. How can I get these resolved?


texts: Views Filters: find nodes that have more than one term in taxonomy vocabulary

texts:
How can I set a filter to find nodes that have more than one term in a particular taxonomy vocabulary?

Note: The vocabulary allow unlimited values and is required field. So, nodes can have 1-∞ terms.


texts: set specific time to cron for specific php script

texts:
Actually i want all unpublish nodes to be delete automatically whose created date is 2 days ago. I can write php script for that and also include that code in hook_cron api.

but i am confused that my site is set to be run cron after every 3 hours and i want that php script to be run after 24 hours. can i set specific cron time for specific job. i dont want change the site cron job time.


texts: Using modules with almost similar functionality together on production site

texts:
I have 2 modules with similar/alternative available and I have to use both. Those are Entity Reference and Search API.

Now the situation is that there are few modules which require References and Search modules as a dependency. It is a need and I have to use it.

Can I use all these modules at the same time on a production site?

Is there any possibility of clash or site crash?


texts: very bad thing of output the vocabulary in drupal 7

texts:
I created four  vocabularies for the "article" content type.
I want to output the vocabulary which belongs to the node; when I used print render($conetent['field_vocab']), it output the vocabulary, but the HTML structure is too bad; more useless <div> and classes make me crazy. In order to remove them, I output it like this:

$content['body']['#object']->field_vocab['zh-hans'][0]['taxonomy_term']->name;

It's too long, and it makes me crazy too. If the vocabularies contain more than one taxonomy term, it only prints one.

Is there a better way to output the  vocabulary?


texts: Add Help Text for User Roles Field on User Edit Page

texts:
I would like to add some help text for one of the fields displayed on the admin user edit page (the page seen when an admin edits a user account).

The help text would provide a brief description of each role that could be selected.

Is there some hook I can use to update the admin form?


texts:
I would like to create static pages (because I don't want to go through creating a proper theme) but still use Drupal as a CMS. For example, I might create a content type to add images to my Drupal site and then create a view to display images in a particular way. I would then like to be able to insert the code that will display that view in my static page. How would I go about doing this for views, blocks and panels? I am using Drupal 7.

Your help is much appreciated.

Kamal


texts: Best approach for tracking stock levels for custom line type items using Drupal Commerce

texts:
Does anyone have a best practice approach for tracking stock levels for custom line items that are configured to use product reference fields?

The custom line items are created used the customizable products modules and use product reference fields to reference other products in the inventory.  When a product that references the custom line items is purchased, stock levels for the referenced products are not decremented properly.


texts: How do I enable PHP extensions on CentOS to finally finish installing/configuring Drupal?

texts:
I am trying to install Drupal 8.0.5 (a standard profile) on Apache 2.4.6 on CentOS 7, with PHP 5.6.19.  But in the GUI, I get a problem on the requirements page.  It says "PHP extensions disabled.  Drupal requires you to enable the PHP extensions in the following list... gd"

I have installed, with yum install these packages: gd, gd-devel, php-gd, php-pdo php-mbstring, php-xml.

I have installed various other packages.  I have no reason to think that PHP gd extensions have not been enabled.  They've certainly been installed.  I've restarted Apache services and MariaDB services. I've rebooted the sever.

I reinstalled Drupal and PHP.  I created a php.ini file with "extension=gd.so" as the content.  A minimal installation fails for the same reason.

What should I do to get Drupal working for the first time?  I have never done this before.  How do I enable the PHP Extensions?  Or is the message false?  If it is, what should I do?


texts: geofield types failed to add with commerce services

texts:
I have added field of type Geofield  that failed to save through services despite working well with node and user modules

It returns that error 400 : Invalid field_geoloc value given I am using the same field structure for node and user.

I did some debugging and found that the error comes from file commerce_services.module line 1406
that piece of code

if (count(array_diff_key($value, $field_info['columns'])) > 0) { return services_error(t('Invalid @field value given', array('@field' => $field_name)), 400);
    }
here is the field structure

"field_geoloc": {
    "und": [
        {
            "geom": {
                "lat": "22",
                "lon": "22"
            }
        }
    ]
}

Please help me fix it or guide to fix it.
Thanks in advance