texts:
I have problems to configure my dupal 7 installation to allow entering tables.

I will add the link to the page I mean because not everytime sure that I use the right words.

I have created a type (admin/structure/types) which has four fields (admin/structure/types/manage/my-type-name/fields). The field body (admin/structure/types/manage/my-type-name/fields/body) has set filtered text as text processing. The selectbox under the CK-Editor has the value Filtered HTML. I tried to set its value to a custom clone of Filtered HTML which allows the attentional tags table, td, th and thead.

How can I allow tables for a special kind of type?


texts: How to conditionally display some things in the message text created by the Message module?

texts:
I am using the Message module to record some activity.

I have a Rule generating a Message. The Message Type has a couple of fields, and I am setting them in the rule. That part all works great. I can verify the contents of each of those message fields.

Now what I'm trying to do is to conditionally display some things in the message text. I have a couple of Message Text rows and they all display what I expect them to. But for one of these, I want only want to display something if one of the tokens matches a condition.

I have selected the PHP Code filter type on that particular Message Text box, but I just don't know to actually evaluate the field values of the current message. I've tried t() and token_replace() and I just am not getting it.

So here is a simple question for this problem I'm having. Say I have a text field on this message type called field_foo. And I want the message text to display the length of that field. I basically want something to the effect of <?php strlen(this-message:field_foo) ?>.

How do I reference my message instance's field?


texts: Problem creating redirect from page with %20

texts:
I've been researching the issue for hours and can't seem to find a working solution to this problem. I've created a redirect from /sites/default/files/OLB%20Registration%20Guide.pdf to /sites/default/files/downl_section/Online-Banking-Registration-Guide.pdf that doesn't work.

Here is the line in .htaccess

Redirect 301 "/sites/default/files/OLB Registration Guide.pdf" /sites/default/files/downl_section/Online-Banking-Registration-Guide.pdf

My first inclination was to remove %20, but still nothing... Does anyone have any insight as to how to create a redirect where the original url contains %20?

Thanks!


texts: What is the url for product page in drupal commerce. Its admin url is : admin/commerce/products/2

texts: I am using drupal commerce for first time. I have created a product. I am unable to find the product view url. Its admin url is : admin/commerce/products/2


texts: menu_get_object() not returning node object when view's display is Entity Reference

texts:
I needed get field's value and pass it as contextual filter to "entity reference view" just described as views and contextual filters with entity reference field.

But $Node = menu_get_object() is not retuning node object.

The scenario

Nodes Items of custom content type

Title : Sony LCD
Tags : electronic

Title : The godfather
Tags :Books
.
.
Items(n)

Node of custom content type Review. It's node id is 10

Title : Make a Review
Filter Tags : Taxonomy terms reference (e.x electronic, books, movies etc)

Attach a entityform to above node using entity reference and also back referenced with enityreference_current

My Review Item : EnityReference field - Entity reference view - Autocomplete widget
Review : text area

When node/10 is viewed, user will have to fill "my review item",but should be filter based on "Filter tags" that was already set.

Code inside VIEWS PHP under Contextual Filter

$node = menu_get_object ();
$ Related_ids = array ();
    $ Related = field_get_items ('node', $node, 'field_filter_tags') // Get the term reference field
    if ($related && is_array ($related) && sizeof ($related)> 0) {
      for ($i = 0; $i <count ($related); $i++) {
        $ Related_ids [] = $related [$i]['target_id'];
      }
    }
    return implode (',', $related_ids);//to perform AND

Update : I also tried with $node= node_load(arg(1)); , this time $node variable set but not type of node. Then I dpm(arg(1)); it shows string autocomplete(yes just autocomplete not string entered in field).


texts: Change texts according to other language in template.php

texts:
I have multilangual website ancak my site's footer is in template.php.

Like this:

function _site_footer(){
    global $language;

    $output = '

                   this is a lorem ipsum

    return $output;
}

I want, when I turn my site to other language, get this footer:

function _site_footer(){
    global $language;

    $output = '

                   TESTTESTTESTTEST

    return $output;
}

How can I change it in template.php? Thank you.


texts: Get error when displaying a token in a header view

texts:
I have a view working fine. Now I added a header text (Global Text) printing a token for the first contextual filter :

<?php print t('Subastas de ') . !1 ; ?>

The token is printed right but I get this error. The token value is: DIBUJO

Notice: Use of undefined constant DIBUJO - assumed 'DIBUJO' en eval() (línea 1 de /Applications/MAMP/htdocs/subastaspintura.com/sites/all/modules/ds/ds.module(954) : eval()'d code).

In this capture you can see how the Global text header is set up:


texts:
OK, so I have a weird one that I have never seen before. I have about 15 Drupal sites setup locally that are all running fine. I am attempting to setup a new one that I am setting up from a Drush archive dump that was given to me. I have used this method plenty of times in the past.

I am on a Windows 7 box and am running WAMP server v2.5. Apache v2.4.9, PHP5.5.12 and MySQl 5.6.17. So, I create the database, create the entry in my HOSTS file and create the entry in my Apache httpd-vhosts.conf file. I tweak my settings.php file with the correct dB connection info and attempt to go to the site and the site comes up just fine.

I can view the homepage. If I attempt to go to something like local.mysite.com/admin, I get "Access Denied" as expected. However, if I go to local.mysite.com/user and then login with user 1, I get "This site can’t be reached - ERR_CONNECTION_RESET" in Chrome and then I continue to get that even if I attempt to go to the homepage again. If I go to local.mysite.com/user/logout, it will successfully log me out and then the home page comes up again just fine. It only won't display when I login.

I thought maybe it was the temp directory, but I used Drush to check what that was set at and made sure I had that on my local box. I checked the PHP logs, the Apache logs and the MySQl logs and nothing jumped out at me as out of the ordinary. I also checked to make sure the .htaccess files were in place. I also checked this in multiple browsers and got the same result. I also tried changing the name of the site from local.mysite.com to "foo" in my HOSTS file and in Apache and restarted Apache and the site comes up, but it does the same exact thing. The site cant be reached as soon as I login. I'm at a total loss here.


texts:
I am using drupal 7, and I have created a custom module. This module consists of a form that can be used for adding records to the database. But I saw that the link to accessible to all the users, even anonymous users.

I want to restrict the access to this module and form from all the normal users; only the administrator users should access it.

I have created a role called Administrator and permitted my module only for the administrator. It still doesn't work.

How can I restrict the access to my custom module?


texts: Is there a way to do text substitution within fields in Views?

texts:
I usually find what I need in here without asking question but this time couldn't find anything.

I have a view which lists documents from a file field of one of the content types. This content type (Info Page) has a Title, Body, and file field. The file field can take up to 10 PDF documents. The end result is a list of all documents attached to all published Info Pages and each item is a direct link to the pdf file. These documents will be updated quite frequently and I want to make the update process as smooth as possible.

Here is what I'm struggling with. The names of the files attached to the document will have hyphens/dashes instead of spaces and possibly some other characters/words I would like to remove. I don't want the user to provide another Text in another field, instead I would like the link title to be generated form the file name with some characters substituted for spaces and possibly some words removed. Does anybody know of a module which would have such a functionality?

Help would be much appreciated. Thank You

Drupal 7.33
Views 7.x-3.8


texts:
I want to add drop-down list that allows users to select which page they want to visit.

How can I accomplish this?
What code should I use?


texts: Migrating a site that's been updated from 6 to 7

texts:
I had a Drupal 6 site on a server that I've made a local copy of using Backup & Migrate. I've now upgraded this site to Drupal 7 on my localhost. When I try to move this to a server (or, as I've discovered, a new installation of D7 on localhost) I get the following errors once I run update.php

  Error message

  Notice: date_default_timezone_set() [function.date-default-timezone-set]: Timezone ID '0' is invalid in drupal_session_initialize() (line 273 of /Users/username/Sites/sitename/includes/session.inc).
  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'source' in 'field list': SELECT DISTINCT SUBSTRING_INDEX(source, '/', 1) AS path FROM {url_alias}; Array ( ) in drupal_path_alias_whitelist_rebuild() (line 380 of /Users/username/Sites/sitename/includes/path.inc).

  The website encountered an unexpected error. Please try again later.

  Uncaught exception thrown in session handler.
  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ssid' in 'where clause': SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => Hz-vcoMFEI-tL3Tw55qLQG6kNqXmB2pziLRC1SMQVYw [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 209 of /Users/username/Sites/sitename/includes/session.inc).

No idea what's going on as the upgraded D6-D7 original site is working perfectly - it's when I try to migrate it to a server that it all seems to break down.

Any ideas?


texts:
I have created a custom block using Entity Query with pagination to get the data and everything works fine with

$render[] = [
  '#type' => 'pager',
];

But I can find a way to change the position of the pager. For example, I want to include them in my custom block template. I can't do that.

For Drupal 7 we have the following option but I can find the same way to do that in Drupal 8

theme('pager')

Thanks for your help


texts: Routes node.add.CONTENT_TYPE are no longer available starting from Drupal 8.4 in hook_menu_links_discovered_alter()?

texts:
If you implement the hook_menu_links_discovered_alter() hook in Drupal 8.3 you have access to change the links with a code like this:

/**
 * Implements hook_menu_links_discovered_alter().
 */
function onlyone_menu_links_discovered_alter(&$links) {
    $links['node.add.article']['title'] = t('New name');
}

This code comes from the issue Improve the Add content page for the Allow a content type only once (Only One) module. But starting from Drupal 8.4 the same code gives an error like this:

  Notice: Undefined index: node.add.article in
  onlyone_menu_links_discovered_alter()

I searched inside the Drupal change records but I don't find anything talking about this change.

Now in Drupal 8.4 how you can change a link title?


texts: GraphQL performing INSERTs on cache_discovery table

texts:
We have a drupal site which acts as GraphQL API endpoint and during heavy loads (about 17 graphql requests/sec), our site seems to go down and the bottleneck appears to be GraphQL doing a lot of INSERTs to the cache_discovery table.

Does anyone know if this is a drupal core feature or can we disable this just for graphql?

Thanks


texts: How to upload files using the Feeds module?

texts:
I created a custom content type and I want to upload an XML file using the Feeds module. Can somebody explain how to do the mapping correctly? Should I add a new importer or use a node importer?

I want to perform the upload using an XML file. I have unicode characters in my file.

I am not able to convert it to a CSV file. I have tried converting using Open Office but it is not working.

I find using feeds a bit complicated.

Are there other solutions to upload files into database?

Note: When I try to upload to says no new nodes created.


texts: Is there any programming method to hide or show each Field's Label of custom content type in twig template files, regardless of fields manage display setting?


texts: Saving a webform programmatically in a custom webform handler throws "Entity validation was skipped."

texts:
I am trying to save a webform submission inside the postSave in a CustomWebformHandler class.

class CustomWebformHandler extends WebformHandlerBase {
[..]
     public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
        $data = $webform_submission->getData();
        $data['ssa_attachment'] = $doc_id; //doc_id is retrieved with a query
        $webform_submission->setData($data);
        $webform_submission->set('in_draft', TRUE);
        $webform_submission->save();
     }
}

I get the following exception.

  Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "Entity validation was skipped."

I tried to validate before saving and I get this exception.

  Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction: SELECT w.next_serial AS next_serial\nFROM\n{webform} w\nWHERE webform_id = :db_condition_placeholder_0 FOR UPDATE;

How can I trigger the validation before saving?


texts:
I've seen this functionality being used quite often especially on news sites where latest articles snippets/calls-to-action pop out of the side of the browser - See image below:

Any idea what is the most common way this implementation is handled in Drupal?

I had a look at a couple of Drupal modules but didn't strike it lucky.


texts: How to prevent accidental clicks in the Save button when saving a node?

texts:
I need to prevent accidental clicks in the Save button when a node is being saved.

I found this module  which does exactly this. But the problem is that it uses javascript (jquery). Then if the user disable javascript this module is useless.

My problem is that in my website the user get points when creating nodes, so I have to prevent this in a more secure way.

How can I do this?

What do you think of these ideas?:

1) Maybe I would forbid the node being saved more than one time    programmatically instead of disabling the Save button.

2) Or better: I would allow the user to just save a new node every 5 minutes.


texts: Autoselect parent taxonomy if child is selected

texts:
How can I have the parent taxonomy be automatically selected when one of its children gets selected? It would be a convenience if the parent is selected automatically in the backend for every child selected.

Right now, if I select a child and not the parent, then search or browse for the parent term, child terms under that parent are not brought back. This doesn't seem right.


texts: How do I fix my module so an external library has no problem running require_once?

texts:
I'm writing a wrapper module for an external library. Now when I create a new instance of a class defined in the external library I get an error message:

PHP Fatal error:  require_once(): Failed opening required '../../directory1inlibrary/fileinlibrary.php' (include_path='.:/usr/share/php:/usr/share/pear')

The file which defines the class is in libraries/libraryname/directory2inlibrary/subdirectoryinlibrary, so a priori it looks fine. However, apparently once I use the file from within Drupal the path of the file is ignored. How do I fix this without doing anything to the library? Should I simply define a global path in my module to include all the library directories?


texts:
I have been dabbling with Drupal 7 and I am not quite sure what I did but turns out that after the interval of that mindless exploring, if I decide to add a specific Content type, it redirects me straight to only one content type (a custom content type I created using the Add Content type option) without consenting me on what kind of content type I specifically want.

I am not sure where I goofed up but does anybody know how the 'Add content' redirects you to a specific content type happen. Maybe I disabled the existing content types somehow, but I am not quite sure.


texts: How to create audit trails/order revisions?

texts:
I've been working with Drupal Commerce for a few months now. As a non-profit, our organization hosts an e-commerce/e-learning site. We're a smaller organization with approx 20 staff users and <20,000 regular customers.

How do others handle creating audit trails/order revisions within Drupal Commerce? There are quite a few modules out there, but I have yet to find the right combination. Currently, we've added Line Item Revisions module and use the Order revisioning built into Drupal Commerce.

Here are some concerns I'm attempting to address:

How did the order end up in the current state (who and why)?
What was recently changed (line items, status, owner, coupons, etc. who and why also)
How do you identify who deleted records, specifically financial records? Secondly, how to you log what the deleted records originally entailed?

As a non-profit, we're audited annually and when staff can accidentally delete payments/orders/etc for money already collected or products already delivered, we lose any history of how it all happened. I'm hoping I'm not the only one who has this question and some of the more tenured users here can point me in a direction.


texts: hook_form_alter ajax callback never fired

texts:
My use case is the following : I've an autocomplete widget to a referenced entity and I want the value of an other autocomplete widget to be selected when the first one is done.

I'm aware of this topic and of the autocompleteclose ajax event, but was not able to see any ajax request fired in the browser's console.

Since it's my first attempt to altering drupal's forms and using its AJAX API, I decided to try the simplyest test as possible on a text field, but, was still not able to see any ajax request in my browser's console... Here's my example code :

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id){
    $form['my_field']['#ajax'] = array(
        'event' => 'change',
        'callback' => 'my_ajax_callback',
        'wrapper' => 'my-wrapper',
     );
    $form['my_field']['#attributes'] = array('style' => 'color:red');
}

I can see my form is altered because my field label is red... But when I type in it, the ajax callback is not triggered and I do not see any error in the console.

Jquery lib is loaded and ajax is working because I can see ajax requests when using autocomplete fields... Anyway I tried to attach the drupal core ajax lib as mentionned in this post ($form['#attached']['library'][] = 'core/drupal.ajax';), but nothing changed...

I'm obviously missing something here... Has anybody an idea ?


texts: "Node Recommendation" Module alternatives

texts:
I what hoping to use the Node Recommendation module for drupal 6, but after testing it for a while I have come to realize that this particular module has to many issues.

http://drupal.org/project/noderecommendation

The idea of the module is excellent! give node recommendations based on related taxonomy terms and content types.

Are there any alternatives that are under active development and are stable enough that do something similar?

Thank you.


texts: How do I limit the number of rows affected from the query?

texts:
In my custom module for Drupal 8, I am using the following code.

$query = $this->connection->select('node_field_data', 'nf_data');
$result = $query->execute();

I want to get the first 500 rows. I tried with $query->limit(50), but that gives the following error.

  Call to undefined method Drupal\Core\Database\Driver\mysql\Select::limit()

What is the correct code to get the first 500 rows?


texts:
Is it possible to render a menu in a block or a node's body using [embed] or any similar token?

What I want to achieve is to render the main menu in a custom block. I don't want any solution that involves PHP or changes in source code. Token seems like a good option but I'm unable to find a token to render the main menu.

Thanks for the help in advance!


texts: Simple OAuth + JSONapi response when token is expired - Decoupled

texts:
We're using the 'Simple OAuth' and 'jsonapi' modules for the front end authentication in Angular of our decoupled Drupal project.

We've noticed that when the user credentials are correct but the token is expired the header response is still 200 'ok' with a message that indicates that the Token no longer valid.

But we need a 400/401 or 403, like it is described in the oath documentations.

Is there a reason why this is implemented like this? Or is there a way to alter the response?


texts: How to use content type tokens File path in file and image field?

texts:
I want to have one field for header images, but sort them by type of content. Sadly, when I try to do that, I get:

  The File directory is using the following invalid tokens: [content-type:machine-name].

there is no "avaliable tokens" link under File path box, but when I click generic one, I get:

Current date - Tokens related to the current date and time.
Current page - Tokens related to the current page request.
Current user - Tokens related to the currently logged in user.
Random - Tokens related to random data.
Site information - Tokens for site-wide settings and other global information.
Variables - Tokens for variable values.

Now, I can add Node to the list with File (Field) Paths, but that's overkill. I want more basic thing - content type or more generic bundle tokens. And they are not provided. Is there something I'm missing?


texts:
I'm trying to write a patch to make module Drupal coding standards.

And this one the complains that have and I do not know how to fix it.

  Line 148: the use of REQUEST_URI is prone to XSS exploits and does not
  work on IIS; use request_uri() instead [security_12]
      return "http" . (isset($_SERVER['HTTPS']) ? "s" : "") . "://" . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";

Here is the function that is been affecting.

function module_get_url() {
   return "http" . (isset($_SERVER['HTTPS']) ? "s" : "") . "://" . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
}

I know that I need to implement request_ui but I'm not sure.

It should looks like this .... ?

   function module_request_uri() {
       return "http" . (isset($_SERVER['HTTPS']) ? "s" : "") . "://" . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
    }

Any help will be appreciated on how can fix this complain.


texts: using uploaded images for different image styles with Media entities

texts:
Using Media entities, is there a way for some of the media entities to use an uploaded image for a different image style, as opposed to automatically generated or manually cropped?
So for example:
media entity 1 would have:

original image: large image of a tiger, uploaded by an editor
mobile size: automatically scaled down image of a tiger

and media entity 2 would have:

original image: large image of a whale, uploaded by an editor
mobile size: small image of a cake. (Why? Who knows why? CLIENTS!)


texts: Add new tags to Chosen Widget or Display All on Autocomplete Deluxe

texts:
Trying to find a combination of the features provided by the Autocomplete Deluxe widget and the Chosen module.

They're both great in their own right, but I either need Autocomplete Deluxe to display all options when you click the field (like it does in Chosen) or be able to add new terms to a Chosen field (like you can with Autocomplete Deluxe).

Chosen documentation implies it has this functionality, but I haven't been able to work out how to do it from a select list. And Autocomplete Deluxe, which should be pretty basic, I can't figure for the life of me how to trigger the drop-down to show.

Has anyone been able to do this successfully?


texts: Force redirect in submit handler even though destination parameter set

texts:
I add a custom submit handler and now I want Redirect to custom route after form submitted.

This is what I used

use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\Request;
use \Drupal\Core\Url;

function MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {

    if ($form_id == 'node_trends_form' || $form_id == 'node_trends_edit_form') {

        foreach (array_keys($form['actions']) as $action) {
            if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
                $form['actions'][$action]['#submit'][] = 'zyetondev_sync_trends_submit';
            }
        }
    }
}

function zyetondev_sync_trends_submit(array $form, FormStateInterface $form_state) {
    $url = Url::fromRoute('view.trends.page_1');
//    die(Url::fromRoute('view.trends.page_1')->toString());
    drupal_set_message("Done");
    $form_state->setRedirect($url);
}

Submit Handler getting run and redirect redirection work correctly, Problem is when we have ?destination= on Url, How can I force redirect even though ?destination= is on Url?


texts: Seemingly random error when writing to /tmp

texts:
Lately I've been getting numerous errors of this type:

PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp/#

Yet the /tmp directory is set to 777.

Oddly enough: If I try to reload the page several times the error does not occur.


texts: CSS Injector not serving most current version

texts:
I have made changes to a CSS Injector rule on my Drupal 7 site. Despite flushing all the caches several times, the CSS file that is included on the live site is not the most current version of the CSS Injector rule. When I look in the <head> section of the page, I find the CSS Injector file listed like this:

<link type="text/css" rel="stylesheet" href="http://www.example.com/.../css_injector_1.css?nzorcx" media="all">

The part that is confusing to me is the parameter tacked on to the end of the file name: ?nzorcx

If I access the CSS file without the ?nzorcx, the CSS file is the most current version. So it would appear that ?nzorcx is some kind of version thing. Fine. But how do I force it to refresh with the most current version. As mentioned, I've flushed all of the caches already.


texts:
I have an Organic Group page, inside I have a view which lists out news items specific to this OG. However it is showing 'There is no content in this group' when I am not logged in. And shows up fine when I am logged in.

I have checked that the new article is published, the permission of the View is set to 'Permission' | 'View published content', and I also ensured that the 'View published content' permission is checked for anonymous user.

It's obviously a permissions issue, but I cannot see where else I can set permissions. I am using Workbench OG but there are no relevant settings on there.

How do I correctly display OG content using Views?


texts: How to get list of module folders which can be deleted safely?

texts:
I've uninstalled a lot of unnecessary modules recently through admin/modules/uninstall.
Now I want to understand what folders of the modules can be deleted from sites/all/modules.

I've tried drush pmi, but there is too much information.

How can I get list of folders which can be deleted safely now? Any drush command may be?


texts: Using Panels - Node Template.. How do i pass additional arguments for my blocks?

texts:
I have content types: Project, News, and Country.

I have a node template that displays details of a Project. This node template displays a view, which displays all the News. I want to filter all the news by the project's Country.

Project has a cck field: country_id. How do i pass it's value to my News view?

tl;dr: using a panel node-template, how do i use the node's cck field as argument?


texts: How do I alter the file link of an uploaded image in edit/create node form?

texts:
When I upload an image in drupal, a file icon and a file name that links it to original file is created.

For example, I upload "foo.jpg" then

 foo.jpg

is generated.

I want to change the path-to-file url because it's put putting base_url() + path-to-file which results in Not Found. I'm using amazon s3 for file storage.

I only want the path-to-file url without the base_url. Can anyone share some wisdom?


texts: restrict some url access, based on user roles

texts:
I am theming an administrative page.
There are 2 roles (admin, role2) that have access to all the administrative pages. Now, I want to restrict the access to some URLs to the role2 role: Users with that role should be redirected to other pages. How is this done using the template?

I know I can use permissions to restrict the access, but I want to restrict the access basing on the URL being visited.


texts: Using Entity Reference field, get the parent NID in referenced entity (node)

texts:
I have a node that holds an entity reference field (multi value) to other nodes, all the referenced nodes of the same type.

In the referenced nodes I have a computed field that do some calculations. Also, in the parent node I have a computed field that takes calculated values from referenced nodes and do other calculations. All the values are stored in DB.

What I need is every time a referenced node is saved, also to re-save (update) the parent node, so that computed field can make the calculations using the new values from the referenced node.

Is it possible to get the NID of the parent node in the referenced node computed field, so I can add some code to launch the parent re-save?

All I can think right now is using SQL or adding a field (in referenced nodes) that will hold the parent NID when the referenced nodes are created; is it another way?

Thanks.


texts: flowplayer with videojs module and video-js

texts:
I'm not sure how to integrate videojs module with video-js libraries because at the moment I am using the code for video-js to open the swf player in my drupal page which works fine. However I can't get it to play FLV type video and that is because apparently I need flowplayer as fallback from html5.

My question is where should I place the flowplayer folder in conjunction with the rest? Should it go in sites/all/libraries and then I create a content type with field to use videojs module?

Why do I even need videojs module if you can just place video-js javascript code and html code in body of node?


texts: Can we use double quotes for strings inside t()?

texts:
Is it correct what said in the comment #7 for Usernames allow @ symbol?

  t() value should write in single quotes not in double quotes.


texts:
I have installed Drush 8.1.2 on Windows 7, but it doesn't work. Few command are working, but few are not working.

drush uli 1 works
drush dl <project name> works
drush en <project name> doesn't work
drush cc all doesn't work

Running drush en "module name", I get the following:

  Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
  The drush command 'en fieldupdate' could not be executed.
  Drush was not able to start (bootstrap) the Drupal database.
  Hint: This may occur when Drush is trying to:

  bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See drush topic docs-aliases for details.
  connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

  Drush was attempting to connect to:
   Drupal version         :  7.34
   Site URI               :  http://default
   Database driver        :  mysql
   Database hostname      :  localhost
   Database port          :
   Database username      :  root
   Database name          :  staticpages
   PHP configuration      :  C:\xampp\php\php.ini
   PHP OS                 :  WINNT
   Drush script           :  C:\Users\ins237\AppData\Roaming\Composer
                             \vendor\drush\drush\drush
   Drush version          :  8.1.2
   Drush temp directory   :  C:/Users/ins237/AppData/Local/Temp
   Drush configuration    :
   Drush alias files      :
   Drupal root            :  C:\xampp\htdocs\cms-staticpages
   Drupal Settings File   :  sites/default/settings.php
   Site path              :  sites/default


texts: How to remove all the divs inside the $widget of a views exposed filter?

texts:
I need to remove all the divs inside the $widget of a views exposed filter. I need only the single form fields without any html around it.

I don't know PHP.

Any suggestions?


texts: How to trim a rendered item before and after specific symbols

texts:
I've created a field where I store the URL to an image. I need to display the filename of the image without the part before the slash and without the file extension.

  http://some.url.com/folder/this/and/that/361.jpg

should be displayed as 361

  http://some.url.com/url/folder/this/and/that/1021.jpg

should be displayed as 1021

I know that this can be handled field--field-name-of-url.tpl.php file but I wasn't able to apply the solutions I've found correctly.

I tried the regex and explode method but I don't know how to insert it into the code below.

Thanks for any help.

<?php foreach ($items as $delta => $item) : ?>
    <?php print render($item); ?>
<?php endforeach; ?>


texts: How to add 'Welcome {username}' in blocks with Drupal 7

texts:
I am replacing a drupal 6 website by a drupal 7 one with the same content.
On that Drupal 6 website there is a block that comes visible when you're logged in.
As  heading it shows the message 'Welcome {username}' in that block.

I'm looking for a way to do that in Drupal 7, i tried to do this with the module 'Token' but i doesn't work. What's the best way to do this?


texts: Drupal 7 WYSIWYG Editor Auto Spell Check

texts:
My team and I are trying to have the SCAYT (Spell check as you type) feature in the WYSIWYG bar to be automatically enabled, so that we can make our users' jobs easier for them as many of them have requested this. Currently, people are able to enable it in the editor manually. We'd like it so that it's automatically working once they start typing.

I've looked up the TinyMCE module, but it's severely out of date and we won't be using that. I tried to fumble with the code to no avail. I've read different forum but they are all out of date.

Any advice on this would be greatly appreciated and if more information is needed I'll be happy to provide it.

Thanks!


texts: Views isn't pulling custom field correctly

texts:
I've been developing a custom module, which uses the node id, with the rate module, to output the results to a simple mathematical equation (which uses the rate module - i.e. voting api) to calculate the total number of votes.

The calculation is completed as part of hook_field_formatter_view for the field. It is then passed through to the node's display.

The issue arises when passing through this same value to a Views output. It seems the node id isn't passing through to the field, which renders this whole problem impossible. I have been using this to access the node id:

  $node = menu_get_object();
  $nid = $node->nid;

Which is then used to retrieve the necessary values from the database for the calculation. However, all fields are returning 0 (null) values in the views output.

Is this because the node id is not passing through, or could it be something else?


texts: How to get the slick carrousel inside a tabel column in a existing view?

texts:
I generated a table with the help of views e.g.

Name | Title

I would like to extend the table with a third column e.g. Photo

Name | Title | Photo

The foto should be in the slick slider gallery. So if there are more then 2 pictures there should be an arrow left/right

Can this be done with: module Views Field View?

Any other suggestions?


texts: How to limit the terms of the view to the terms used?

texts:
On the product I created a "tags" taxonomy terms field. I have created a hundred "tags".
My products use around 10 "tags".
I created a pageview of my products with an exposed filter criterion "tags".
My problem :
The filter displayed on the product page displays all the terms. I only want to display the terms used by my products. How to do this ?


texts: Views: Relationship with webform submission

texts:
I have a view displaying a list of nodes. Each node has a webform submission related, and the sid is stored in one field "field_sid".

I'd like to be able to access the submission data in the node view, using a relationship thanks to the sid field.

Is there a good and efficient way to do this ?

Thank you very much and sorry for my bad english

Edit : I tried the Sivani solution but unfortunately I wasn't able to link the "field_sid" from the node to the good submission ID. How to do this ?


texts:
I have some 2-point-relations called 'is_member_of' where the source endpoint is a person and the target endpoint is a group.

I like to list all of the members (without using a view).

In the code I build a relation query with the nid 1234 as target (last option = 1)

$query = relation_query('node',1234,1);
$results = $query->execute();
dpm($results);

This lists ALL relations to the nid 1234. I only want to have relations of the

relation_type='is_member_of'

Is there a fieldCondition which can do that?

Thanks.


texts: How to make a form required with states?

texts:
I have a drop down list that displays various fields based on what is chosen and I know that I can toogle the visibility with states but when I try to use required the * span is display but it isn't actually required. What I mean is that even though it's "required" I can hit submit and not get an error message from drupal. Am I doing something wrong or is this currently broken in Drupal 7.8?

        $form['host_info'] = array(
        '#type' => 'select',
        '#title' => t("Host Connection"),
        '#options' => array(
          'SSH2' => t('SSH2'),
          'Web Service' => t('Web Service'),
        ),
        '#default_value' => t(variable_get('host_info', 'SSH2')),
        '#description' => t("Specify the connection information to the host"),
        '#required' => TRUE,
    );

    $form['ssh_host'] = array(
        '#type' => 'textfield',
        '#title' => t("Host Address"),
        '#description' => t("Host address of the SSH2 server"),
        '#default_value' => t(variable_get('ssh_host')),
        '#states' => array(
            'visible' => array(
                ':input[name=host_info]' => array('value' => t('SSH2')),
            ),
            'required' => array(
                ':input[name=host_info]' => array('value' => t('SSH2')),
            ),
        ),
    );

    $form['ssh_port'] = array(
        '#type' => 'textfield',
        '#title' => t("Port"),
        '#description' => t("Port number of the SSH2 server"),
        '#default_value' => t(variable_get('ssh_port')),
        '#states' => array(
            'visible' => array(
                ':input[name=host_info]' => array('value' => t('SSH2')),
            ),
            'required' => array(
                ':input[name=host_info]' => array('value' => t('Web Service')),
            ),
        ),
    );


texts: Anonymous user getting user name as logged in but session expired

texts: Logged in to drupal site and after some time logged out from site. Then visiting pages as anonymous user. But one of the page is displaying some user name as logged in even though user session expired. All other pages are working fine but only single page getting this issue. Enabled Varnish/Memcache on server. Any resolution for this..


texts:
I know you can add css / js with the drupal_add_css() or drupal_add_js(). Is there a way to define dependancies ?

Use Case Example:

  I need a custom tabs/carousel jquery plugin working. I need jquery and
  jquery ui to load first. In order to ensure that i'd like it to load
  after jquery and jquery ui.

How would one do that?

Also, is there a way to declare if a script / library is already loaded? i.e. if i load two jquery (1.4 vs 1.8.1) libraries it'll conflict.

Or would this discussion be better suited for the drupal core issue queue?


texts: Why doesn't my token redirect to the previous url?

texts:
I thought I could use the following code:

<a href="user/login?destination=<?php print token_replace('[current-page:url]'); ?>a link

to redirect users to the page they were on after log in, but it doesn't seem to work.

I can see the correct url on the login page, e.g.:

  mysite/user/login?destination=the url of the page I was on

but when I login I am still redirected to mysite/users/my user name.


texts: EntityFieldQuery: multiple fieldConditon with OR operator

texts:
It seems kinda trivial but I can find out an example on the Internet to do that kind of query:

$entityQuery = new EntityFieldQuery();
$query = $entityQuery->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'contact');
$query->propertyCondition('status', 1);
if (!empty($params_categories))
  $query->fieldCondition('field_category', 'tid', $params_categories, 'IN');
if (!empty($params_contextes))
  $query->fieldCondition('field_family', 'tid', $params_contextes, 'IN');
if (!empty($params_organismes))
  $query->fieldCondition('field_organisme', 'tid', $params_organismes, 'IN');
if (!empty($params_fonctions))
  $query->fieldCondition('field_function', 'tid', $params_fonctions, 'IN');
$query->count = TRUE;
$count = $query->execute();

Where $params_xxx are arrays of tid.

I need to execute these fieldConditions with an "OR" operator. That means that I want to retrieve each node that has at least one tid among the four taxonomy fields.

Now, it seems to act like an "AND" operator and sends me only those that have one tid for each taxonomy field.

Any clue is welcome.

The less complicated solution I eventually implemented:

I decided to proceed by mini queries that I merge together and erase duplicates.

/**
* Implements hook_form_submit().
*/
function grap_contact_repository_form_submit($form, &$form_state) {
  $matches = array();
  $query   = array();
  $categories = $form_state['values']['categories'];
  if (!empty($categories)) {
    grap_contact_get_mini_query('field_category', $categories, $matches);
    $query['categories'] = array_values($categories);
  }
  $contextes  = $form_state['values']['contextes'];
  if (!empty($contextes)) {
    grap_contact_get_mini_query('field_family', $contextes, $matches);
    $query['contextes'] = array_values($contextes);
  }
  $organismes = grap_contact_get_tid_from_name($form_state['values']['organismes']);
  if ($organismes[0] != null) {
    grap_contact_get_mini_query('field_organisme', $organismes, $matches);
    $query['organismes'] = array_values($organismes);
  }
  $fonctions  = grap_contact_get_tid_from_name($form_state['values']['fonctions']);
  if ($fonctions[0] != null) {
    grap_contact_get_mini_query('field_function', $fonctions, $matches);
    $query['fonctions'] = array_values($fonctions);
  }
  // I have all my data in $matches
}

My mini query function:

function grap_contact_get_mini_query($field, $terms, &$matches) {
  $entityQuery = new EntityFieldQuery();
  $query = $entityQuery->entityCondition('entity_type', 'node');
  $query->entityCondition('bundle', 'contact');
  $query->propertyCondition('status', 1);
  $query->fieldCondition($field, 'tid', $terms, 'IN');
  $results = $query->execute();
  if(count($results)) {
    foreach ($results['node'] as $n) {
      // I use the nid as the array key to overwrite the duplicates more easily
      $matches[$n->nid] = $n->nid;
    }
  }
}


texts: update variable from 7.1 to 7.2 : got error message "The form has become outdated"

texts:
Got D7 multilingual configuration with many modules, from which i18n...

Trying to update variable from 7.1 to 7.2 version, following http://drupal.org/node/1660798 #1 tutorial (I also tried other methods explained in other nodes like http://drupal.org/node/1670274 ).

After clearing cache (twice !), replacing old i18n and variable folders with the new ones, I try to run update.php. Nothing happens, I mean reloading same page... I try then to put website into maintenance mode.

After submitting maintenance mode form, got error message "The form has become outdated. Copy any unsaved work in the form below and then reload this page."
So I tried to put first into maintenance mode, before replacing folders. But then back to the same story : update.php reloads its page so I have to check again if I'm still into maintenance mode : BUT I'm not anymore...!

I guess what may happen is that changing variable folder generates the following mistake : Drupal doesn't read correctly its database variables, so doesn't see any more it is into maintenance mode ?

So who from the egg or hen comes first ? How could I manage that and stop eating aspirin ? Thanks a lot for sharing experience


texts: How do I add extra/custom plugins in CKEditor?

texts:
I am copying the templates plugin http://ckeditor.com/addon/templates
I put    it in my D8 folder /core/asstes/vendor/ckeditor/plugins
I do a 'drush    cr'

I do not see the templates plugin under available buttons in my text format

How do I get the templates plugin to show up?


texts:
I need to add a field to represent a person's role on a board. I have a CCK for individuals that includes a field for their position.  I now need to make some changes so that I can keep track of the current position as well as other positions they may have had in the organization.

Originally, I did not set this up as a "User" entity but as a content type.  Now I"m wondering if this is the best way to structure my desired functionality?

Any Advice?


texts: I am populating one of the node fields making third party api call. Since the data from api is supposed to change frequently mainly on node view. My question is, is it possible to clear caching for a specific node in varnish.


texts:
I'm working on a custom Drupal 8 module. In a form submit function, I need to create several entities of different types. I am worried about what will happen if something goes wrong in the middle of the operation, as it will be difficult to clean up the mess.

So my question is: is there any kind of transactional mechanism for entities, similar to SQL transactions, so that I could conveniently rollback in case of an error?

If not, what strategy would you suggest?


texts: How to add “Download file” link in Drupal 7 files attachment when chosen table formatter

texts:
By default Drupal 7 output attached files: file name and size of attachment
I heed to add an additional column with Download link to every attached file.

In my template.php i have added:

// Override attachments files in case of use table formatter
function bkisk_file_formatter_table($variables) {
$header = array(t('Attachment'), t('Download'), t('Size')); // added Download column
$rows = array();
    foreach ($variables['items'] as $delta => $item) {
        $rows[] = array(
            theme('file_link', array('file' => (object) $item)),
            theme('file_link', array('file' => (object) $item)), // ???
            format_size($item['filesize']),
        );
    }
    return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows));
}

function bkisk_file_link($variables) {
    $file = $variables['file'];
    $icon_directory = $variables['icon_directory'];

    $url = file_create_url($file->uri);
    $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));

    // Set options as per anchor format described at
    $options = array(
        'attributes' => array(
            'type' => $file->filemime . '; length=' . $file->filesize,
        ),
    );

    // Use the description as the link text if available.
    if (empty($file->description)) {
        $link_text = $file->filename;
    }
    else {
        $link_text = $file->description;
        $options['attributes']['title'] = 'откроется в новой вкладке';
        $options['attributes']['target'] = '_blank'; // add _blank param
    }
    return '' . $icon . ' ' . l($link_text, $url, $options) . '';
}

i have http://i.stack.imgur.com/W76kW.png

i need to do like this http://i.stack.imgur.com/cmKMj.png

ill be very appreciated for your help!


texts: How to start views at %nid position (from path)?

texts:
I have a portfolio showing somes nodes (views3 + views slideshow using cycle). Everything works fine, I've a default path /portfolio to access to it.

However, I'm trying to set a path for each slide. I would like to use /portfolio/%nid and using %nid in views to default the first viewed slide to this node id.

Anyone know how it is possible ? I've tried with UI but I don't think it is enough.


texts: Commerce free shipping for orders over €500

texts:
I am carrying on with this project where we are supposed to ship for free for orders over €500. I have two rules; Free shipping and NL/BE. I make an address based comparison and role based comparison for NL/BE and amount based in Free shipping. Now, the problem is, when I test if the customer places an order for over €500 and the shipping address is in Belgium, I am still asked whether I want a free shipping or a NL/BE shipping. Obviously this shouldn't happen. What am I doing wrong?

Thanks :)

These are my rules:

{ "commerce_shipping_service_nl_be" : {
    "LABEL" : "Rate NL\/BE",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "commerce_order", "rules", "commerce_shipping" ],
    "USES VARIABLES" : { "commerce_order" : { "label" : "Order", "type" : "commerce_order" } },
    "IF" : [
      { "commerce_order_compare_address" : {
          "commerce_order" : [ "commerce_order" ],
          "address_field" : "commerce_customer_shipping|commerce_customer_address",
          "address_component" : "country",
          "value" : "BE"
        }
      },
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "6" : "6" } }
        }
      }
    ],
    "DO" : [
      { "commerce_shipping_service_rate_order" : {
          "shipping_service_name" : "nl_be",
          "commerce_order" : [ "commerce-order" ]
        }
      }
    ]
  }
}
}

and

{ "commerce_shipping_service_free_shipping" : {
    "LABEL" : "Rate Free shipping",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_shipping" ],
    "USES VARIABLES" : { "commerce_order" : { "type" : "commerce_order", "label" : "Order" } },
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4", "6" : "6" } }
        }
      }
    ],
    "DO" : [
      { "commerce_shipping_service_rate_order" : {
          "shipping_service_name" : "free_shipping",
          "commerce_order" : [ "commerce-order" ]
        }
      }
    ]
  }
}


texts: Moving the a view Contextual Filter default value("PHP Code") to a module code

texts:
I am really wondered to know how I can move my designed view's Contextual Filter default value which is being provided by my written code as PHP Code, to a module code or a hook.

Is there any possibilities?

Moreover, I am not really interested in exporting view and putting it inside some hooks and ... (as it's again using eval for that PHP Code).
I really like to move the Contextual Filter default value which is being provided by my written code as PHP Code, to a module code or a hook.

Even if you can provide me a way to access&manipulate the designed view inside the Drupal, by a module hook/code, it can be really helpful for me.


texts: How can I make the fields in my views "searchable?"

texts: So I have several views on my website with specific fields shown in table format. The search bar only searches through specific content, like pages, and basic pages. How can I modify the views or the search function to make it so that words typed into the search bar will search through the text entered for each field displayed in the views?


texts:
I've taken over a Drupal 7 website, and i'm having trouble with a slow query that is run when an editor visits the /admin/content page. The query in question is the following:

SELECT COUNT(*) AS expression
FROM
(SELECT DISTINCT node.nid AS nid, node.title AS node_title, history.timestamp AS history_timestamp, node.created AS node_created, node.changed AS node_changed, node.type AS node_type, users_node.name AS users_node_name, users_node.uid AS users_node_uid, node.status AS node_status, 1 AS expression
FROM
node node
LEFT JOIN users users_node ON node.uid = users_node.uid
LEFT JOIN taxonomy_index taxonomy_index ON node.nid = taxonomy_index.nid
LEFT JOIN taxonomy_term_data taxonomy_term_data_node ON taxonomy_index.tid = taxonomy_term_data_node.tid
LEFT JOIN history history ON node.nid = history.nid AND history.uid = '1') subquery;

Edit: I've just managed to solve this issue, but there is a more general question:

How can a drupal 7 administrator identify the cause of errant queries to stop them from occurring?


texts: Filter criteria according to the get variable user/*

texts:
have allowed certain roles user pages to been seen by an anonymous user. I have then created a block that displays the latest post of the role user pages.

Is there a way in views to create a filter criteria from the get variable of the anonymous users URL

For example user/30 profile page is requested from the anonymous user. The view gets the id 30 from the url and then sorts the posts in the block view according to that users id

Below I have added some images on the view.

When an anonymous user accesses the authors user profile via the url it needs to display the content the author has created in the block view. The block itself only displays on the user pages by the use of user/* in the block configuration.

I hope this helps thanks again


texts: In a view, how can I display all sub categories of a given taxonomy term with content from each sub category?

texts:
For each article, I assign a 'sub-category' taxonomy vocabulary term.  Then for each 'sub-category' taxonomy term, it links to a 'category' taxonomy vocabulary term.

I have set up a variant of the taxonomy-term template page that passes the category ID as an argument to a view.  This view then uses a contextual filter to display all content within all sub-categories for the given category ID.

To illustrate, say you type in sitename.com/taxonomy/term/1922 which is, say, movies.  The view will display all content marked with movies' sub categories.  So it currently would show this:

/taxonomy/term/1922 (Movies)
Title         |      Sub-Category |
——————————————————————————————————-
Star Wars     |            Sci-Fi |
Star Trek II  |            Sci-Fi |
Home Alone    |            Comedy |
Office Space  |            Comedy |
Thin Red Line |               War |

What I want is to have, say, 5 pieces of content per sub-category titled by the sub-category.  Something like this:

/taxonomy/term/1922 (Movies)

Scifi:

Star Wars
Star Trek II
...
...
...

Comedy:

OFfice Space
Home ALone
...
...
...

And so forth.  So that it would title all sub-categories and show the top x number of nodes per sub-category.


texts: How can I save two logos for a custom theme?

texts: I need to save two custom logos in a custom theme and use them on the site. Can I somehow create a custom field in theme settings or maybe save the path to another logo in one of the .yml theme files?


texts: How to trim text fields entered in the node automatically

texts:
Just now i've discovered that my operator was entering many times organization name prefixed/suffixed with a space. For example " Microsoft" or "Microsoft  ".

That is causing problem when this value is being passed as contextual arguments in the views with this space character making a difference.

I need help as to how I can trim already fed in text and secondly store only trimmed version of text.

I could only find this useful page about this issue.


texts: Custom form with multiple textarea fields

texts: How can I create a textarea field in a custom module which has multiple (unlimited) fields? It should be the same result as selecting unlimited amount of values when adding a textarea fields to a content-type.


texts: Can you get any view to list content based on a field value?

texts:
I am trying to get a list view in a panels node template to show content based on a text field of the currently viewed node.

Just to give you more information I am including my setup below:

Content Type A - textfield called 'ref'.
Content Type B - textfield called 'a_ref'.

Content Pane View to show list of Content Type B but filtered depending on the node being viewed.

Node template on Content Type A with two regions (Left and Right).

On the Left I am displaying fields of the node being viewed.
On the Right I want to show the Content Pane View with a list of Content Type B where 'a_ref' is equal to 'ref'.

I am trying to figure out how to use contextual filters between the node template and content pane but to no avail.

I hope anyone out there can enlighten me on the way it should be done.

Thanks in advance for any help,

Kevin


texts:
I'm trying to figure out allow commenting on the submissions so there can be a back and forth dialog between the user and site admin(s).

In Drupal 8 webform submissions are entities (type: webform_submission) and comments are a field.

I have created a new Comment Type (webform_submission_comment) with the "Target entity type" set to webform_submission).

How do I attach a comment field to the webform_submission entity?


texts: Multistep registration form for two roles

texts:
Goal:

I have two different user roles:

Borrower
Provider

There are 5 categories for these users to choose(they can select all if they want):

Market 1
Market 2
Market 3
Market 4
Market 5

Each roles have different registration forms depending on the categories they picked. Let say:

For Borrower role:

If Market 1:
  step one:
    form A
  step two:
    form B:

If Market 2-5:
  step one:
    form A:
  step two:
    form C:

For Provider role:

If Market 1-4:
  step one:
    form A:
  step two:
    form D:

If Market 5:
  step one:
    form A:
  step two:
    form E:

Where:
  form A = generic registration form
  form B = specific for Borrower role selecting Market 1
  form C = generic form for Borrower role selecting Market 2 to 5
  form D = generic form for Provider role selecting Market 1 to 4
  form E = specific form for Provider role selecting Market 5

Question:
  Is there any module that can do this? Any thoughts how can I achieve this using Drupal API's?


texts:
I have a field_field_collection in content type (used to field collection module and have unlimited value). It has a number of fields as in the picture below:

And I want customize theme for it as template as in the picture below:

How I can I achieve that? I tried to write a template for it, but the result is bad. When I click "add another item" the result looks like shown in the picture under my code below.

Here is my code:

    <?php
    kpr($form);
    print drupal_render($form['title']);
    $i = 0;
    foreach($form['field_field_collection']['und'] as $items){
    if(isset($form['field_field_collection']['und'][$i])) {
        ?>

                    <?php
                    print drupal_render($form['field_field_collection']['und'][$i]['field_field_01']);
                    ?>

                    <?php
                    print drupal_render($form['field_field_collection']['und'][$i]['field_field_02']);
                    ?>

                    <?php
                    print drupal_render($form['field_field_collection']['und'][$i]['field_field_3']);
                    ?>

                    <?php
                    print drupal_render($form['field_field_collection']['und'][$i]['field_field_4']);
                    ?>

    <?php
        $i++;
        }
    }
?>
<?php
    print drupal_render($form['field_field_collection']['und']['add_more']);
    hide($form['actions']);
    hide($form['additional_settings']);
    print drupal_render_children($form);
?>

And here is the result when I click "add another item":


texts: How to programmatically refresh the current page?

texts:
I need to customize a module and after an if statement check, refresh the page:

So what I need is to refresh the page right after this and print out a success message.


texts:
Does drupal_http_request ever cache results?

I am making a request that looks something like:

$url = "http://www.example.com/some/rest/service?" . drupal_http_build_query(array(
    "id" => 1234,
));

$options = array(
    "headers" => array(
        "Pragma" => "no-cache",
        "Cache-Control" => "no-cache",
    ),
);

$response = drupal_http_request($url, $options);

The problem is that I am getting back some cached results.  I am not looking for ways to cachebust this request; I am trying to rule out Drupal caching this internally so I can work with the far end to see why their Varnish is being weird.


texts:
I am using the Webform Rules module and I created an event 'After submitting webform', and an action 'Fetch webform submissions'.

When I add an action 'Show a message on the site', I get all the webform data values and I can print them out in status message.

Now I want to Get the user ID who submitted the webform to send that user a private message (about the form data). But when I add an action 'Fetch entity by ID', I get no webform data values there (I'd like to use a data value as entity ID).

Am I missing something, is this the right way to achieve this ? Any other idea on how to do this please?


texts: Term order when saving a new taxonomy term

texts: By default when you're saving a new taxonomy term it's placed by the alphabetical order, how to make newly added terms to appear below the existed terms? Or even highlight it? Because i have like 200 terms and it's hard to manage it when you're adding a new term.


texts: How to return Views Field Value in Twig Template

texts:
How do I return a field value from Views when using a Views Relationship?
Im using views-view-fields--pagedisplay--html.twig

fields.title.content

seems to return titles but

fields.field_movie_length.content

does not return any vales, however the field exists if I

{{ dsm(fields) }}

I have Twig Tweak & Twig Feld Value modules installed also.


texts: Where are {image_style} and {scheme} coming from?

texts:
I can't find much documentation on this subject other than https://www.drupal.org/node/2122201. This leads me to think that the subject is either much easier than I think, and doesn't have documentation because everybody knows it, or that there isn't much available.

I have been working with the last example on that page, but I can't figure out where {image_style} and {scheme} are coming from.

I need to create something pretty simple, where there's a path that links to a page that requests some data from an API. For example, if someone browses to mysite.com/example/johndoe, then the page requests data from example.com/users/johndoe and displays it. So, I need to also have access to the entry in the URL to forward it to the API with my module, not just routing a ton of pages with a certain URL pattern to a single page.

I've found plenty of documentation on static page routing, and I have understood that.


texts: getting uploaded file name at node title

texts:
Users will upload files.  The user will tag the file with a project name and some keywords and an optional text comment.  I have made a content-type called 'image', that has filed for title, file, project, keywords and comments.

I want the tile of the node to be the name of the uploaded file.  The name of the filed is 'file' the field is of type File, the widget is of type File, and the filed name is field_file.  I have the token module and the "Automatic Nodetitles" module.  The token module gives me token "node:field_file_body", this is not the file name.

How do I set the title of the each "image" node to the name of the uploaded file?


texts: How to clone a content type and all nodes related

texts:
My site is using Ubercart, so now I want to use Commerce module instead, the problem now is Product content type, when I turn off all Ubercart modules, Product content type will be disabled.

I have more than 1000 nodes (Product content type), so now how to clone Product content type and moving all nodes to new content type?

Thank so much.


texts: How to disable one sort/direction combination from a combined Better Exposed Filters field?

texts:
Over at this previous question I figured out how to give a view a list of options that look like this:

  Sort by

  Date - Newest
  Date - Oldest
  Price - Highest
  Price - Lowest

Suppose there was a particular sort order combination of sort option and sort direction that didn't make any sense. For example, imagine an "Editor's Choice" sort, where staff apply a rating to products to give the best products a boost.

This makes sense:

  Sort by

  Editor's choice
  Date - Newest
  Date - Oldest
  Price - Highest
  Price - Lowest

This is just a bit strange:

  Sort by

  Editor's choice - most favoured
  Editor's choice - not favoured
  Date - Newest
  Date - Oldest
  Price - Highest
  Price - Lowest

...not least because 50%+ of products will be equally at the bottom of the "not favoured" list. This sort might also give the misleading impression that the product at the top of the "not favoured" list has something wrong with it, when actually it's equally not-singled-out-for-praise with 50% or more of the shop.

What I'm currently doing, is the brute force approach - using CSS to set the option based on 'Editor's choice Ascending' to display: none;. I don't like this, because the wrappers mean I have to use first/nth child selectors which could mean the option gets hidden in future after a seemingly inconsequential update or views config change.

Is there a more stable way to properly remove this option from the form?


texts: Storing additional data with a node reference

texts:
What is the best way to store additional data in a Drupal 6 site pertaining to CCK node reference fields?

Suppose that a content type has a repeating node reference. I would like to be able to describe and/or annotate the node reference and describe the relationship between a "Person" content type and a "School" content type (e.g. "person attended school," "person donated to school"), or just have a chunk of text to go along with the relationship.

If you have a repeatable noderef field, you get a table like

CREATE TABLE  `content_field_foo` (
  `vid` int(10) unsigned NOT NULL default '0',
  `nid` int(10) unsigned NOT NULL default '0',
  `delta` int(10) unsigned NOT NULL default '0',
  `field_foo_nid` int(10) unsigned default NULL,
  PRIMARY KEY  (`vid`,`delta`),
  KEY `nid` (`nid`),
  KEY `field_foo_nid` (`field_foo_nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

I could create a module that maintains a table like the following, which is used to store the metadata.

CREATE TABLE  `mymodule_noderef_metadata` (
  `vid` int(10) unsigned NOT NULL default '0',
  `delta` int(10) unsigned NOT NULL default '0',
  `metadata` longtext,
  PRIMARY KEY  (`vid`,`delta`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

The problem with this is that I would have to do a hook_nodeapi to update the table on both "nsert" and "update" to be able to handle revision rollbacks.  In the particular implementation I am thinking of, there could be a pretty big performance impact of doing this.

Am I overthinking this? Is there a better way to do this?
I searched around for a module that does this, but didn't find anything.


texts: How to use 2 twig template for for one field (or how to add a variable to a template from a template)

texts:
Let say I have a node template which is calling twice the same field like the following:

...
{# First call #}
{{ content.my_field }}
...
{# Second call #}
{{ content.my_field }}
...

I also have a preprocessing function which is adding VAR1 and VAR2 to the 'my_field' array like the following:

function mymod_preprocess_field(&$vars) {
  if (isset($vars['element'])) {
    $fn=$element['#field_name'];
    if ($fn=='my_field'){
      $vars['VAR1'] = 'a value';
      $vars['VAR2'] = 'another value';
    }
  }
}

I would like that the first call of 'My_field' use the default twig template and the 'VAR1' value... As you can imagine, I could do it as this is the normal way Drupal is working.
But I didn't success to make use of an alternate twig template for the second call (and also, I would like this second template use 'VAR2')

My first idea was to put the following just before the first call:

{{ set content.my_field.is_first_call = true }}

and to use only the default template (I mean not 2 templates) with something like

{% if is_first_call %}
  ... code to print the first call
{% else %}
  ... code to print the second call
{% endif %}

But I couldn't succeed to transmit a value (is_first_call) from the node template to the default my_field template

Final note: I have added the 'VAR1/VAR2' story because I have also tested the {{ content.my_field | without ('a_check_var')}} filter: the idea was to remove a_check_var from the array to use a construct like {% if a_check_var %} in the default template.
Unfortunately, my preprocess function which is adding 'VAR1/VAR2' runs after the without filter


texts:
Have this scenario, a user must get 10% discount on only these products (product 1 & 2 is defined in rules), if at least 5 items of each is in cart.

Cart:

5 pcs    product 1         500
5 pcs    product 2          50
1 pcs    product 3         100

with the discount, the total will be 595, since the user will get 10% on 500+50 and not product 3

If the scenario is

5 pcs    product 1         500
4 pcs    product 2          50
1 pcs    product 3         100

the user will not get any discount.


texts:
I have enabled Xdebug in my PHP installation and tried it with Drupal 7. I am interested in profiling, which function runs how many times and where are called (whole tree). There are php.ini settings:

zend_extension="D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_port="9000"
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir="D:\xampp\tmp"
xdebug.profiler_trigger=on
xdebug.profiler_append=on
xdebug.max_nesting_level=1000

In Drupal 7 it generates cachegrind.out.XXX file, which i was able to open in PHPstorm, or in wincachegrind.

But in Drupal 8, it generates aprox. 400MB file and when i try to open it (PHPstorm or wincachegrind), it throws errors. These are different Incorrect profiler snapshot format, incorrect function parameters, ...

Have someone successfully profiled Drupal 8 functions with Xdebug? Is there some special setting, which I am missing? I wonder, that in Drupal 7 it worked smoothly. Or if you have better tool for this purpose, I would be happy, if you could post it here.

I use windows and PHP 5.6. That is why I choose xdebug and asked this question. Xhprof is not for PHP 5.6 and Tideways for windows is "crap"...


texts: Is there a way to provide a Select All / Check All checkbox for a field that displays multiple checkboxes in Drupal 7?

texts: Seems like there is no core config to setup a "Check All" checkbox unless I missed where it is. I'm creating a content type and have a taxonomy reference field and I have alot of terms, which means alot of boxes I have to check. Anyway to provide a checkbox to select everything?


texts: Creating an exposed filter on a view as a list with taxonomy terms

texts:
I have categories of photographs and each photograph is categorised. So to expose the filter to the anonymous user they can click on a category and it shows that categories images.

How would I replace the select list or auto complete exposed filter with this so I can then style the list as a horizontal small menu above the view?


texts: How to apply a custom class to a .field__item in an entity reference display?

texts:
I have an entity reference field with multiple values, referencing various content using a custom view mode.

I need to apply the same custom class to each (delta) row.

By default Drupal (twig?) is applying a class of .field__items to each row, but this is not specific enough, as this is also used for other fields within the view mode.

What is the best way to achieve this?


texts: 6 - No content displaying though content is there

texts:
I'm new to drupal, moved from WordPress. I'm trying to get a local install of a client site working. I have the site running normally but no content wants to show.

The content is there, I can see it in the backend and on, say, the blog page it has the right amount of paginated links. Plus the markup and css are correct. The div is empty though.

I've disabled memcache, that might be it, plus all things on the net I could find.
- truncated the cache tables
- run update.php
- tried creating a new view, same issue

plus some others I can't think of right now.

Any help with debug pointers would be much appreciated, thanks.


texts: Drupal rendering Custom Element children

texts:
Here is the complete code of element info

function MyModule_element_info() {
  $types['my_element'] = array(
    '#input' => TRUE,
    '#process' => array('module_element_process'),
    '#theme' => array('module_element_theme'),
    '#theme_wrappers' => array('form_element'),
    '#config' => array(
      'module' => 'some_module',
      'params' => array(),
    ),
    '#default_value' => -1,
  );

  return $types;
}

function module_element_process($element, &$form_state, $complete_form) {
      $element['my_element']['input_hidden'] = array(
    '#type'                    => 'hidden',
    '#value'                   => '',
    '#attributes'              => array('class' => array('hidden-field')),
    '#validate'                => array(),
      );
}

function theme_module_element_theme($variables) {
  $element = $variables['element'];

  return '
' . drupal_render_children($element) . '
';
}

It output the field as

 field_webform_group[und][0][my_element][input_hidden]

Why is the und(undefined) showing in the form field?

If I have multiple child to render how to output  the child fields?

 '
' . drupal_render_children($element['input_hidden']) . '
'.
 '
' . drupal_render_children($element['input_select']) . '
';

How do I process the element value on submit?

Thanks


texts:
I need to create a Controller that serves data as a download when accessed. That file is not in the file system but in memory; that's why I need a Controller instead of just serve file.

How do I create a download link from data in memory?


texts:
How to turn off the notification about the site being offline, when in maintenance mode?

  Operating in maintenance mode. Go online.


texts:
I am creating an Excel reading module in Drupal 8. I want to get the real path of a file for reading it from a path like public://2016-03/Places.xls.

What function should I call for getting the real path of a file?


texts: D7 500 error after accidental deletion of base theme

texts:
I am using adaptive theme as a base for my sub theme and I accidentally deleted the base theme. I knew it wasn't supposed to be a big problem if I just re-downloaded and dropped  the theme back in the file directory but upon doing so I continued to get a 500 error.

update : the specific error in the sites log, not the server log is:

   Call to undefined function load_subtheme_media_queries()


texts:
I have created a rss feed in a view and it's displaying too much information.
I found out that I could exclude certain fields from the feed by clicking the exclude boxes at admin/content/node-type/[content type here]/display/rss.

My problem is this: each feed displays a heading (which is a link) and underneath that there is a date (and the rest of the information below that). This seems to be the post date for the content type.

I would like to get rid of this date (it's confusing since the content type is an event which has its own date and they don't correspond). How can I do this?

Is the only way to fix this by editing the php code somewhere? I did notice that if I click on the theming: information (in the basic settings in the view) it lists some files for style output (such as views-view-rss.tpl.php) and row style output (such as views-view-row-rss.tpl.php).
Is this where I need to start?


texts:
I am using Beauty tips module to show AJAX content on hover, But When first time it loads I am getting unexpected look. From second time onward I get correct look.

I have attached an image of the problem.

The code that I am using for this is :

$options['bt_drupal_help_page'.$nodeid[$i]] = array(
  'cssSelect' => '#rating_'.$nodeid[$i],
  'ajaxPath' => $base_url.'/average_rating',
  'ajaxData' => array('rating'=>$nodeid[$i]),
 //'ajaxLoading' => '<blink>Wait Until It Loads...</blink>',
  'ajaxType' => 'GET',
  'width' => 'auto',
  'height' => '1000px',
  'ajaxCache' => false,
  //'windowMargin' => 5,
   'cornerRadius' => 15,
  //'cssClass' => 'tooltip-box',
 //'cssStyles' => "padding: 2px",
 //'overlay' => true,
 'shrinkToFit' => false,
 'killTitle' => true,
 //'hoverIntentOpts' => '{interval:300,timeout:500}',
);

beautytips_add_beautytips($options);

Please let me know, whether I am doing something wrong?

Thanks in advance for the help.


texts: File to media migration: use node title for media title

texts:
I have my files migrated from D7 to D8 (using d7_file source plugin to an entity:file destination).

I then migrated those files to media (using file_entity source plugin to an entity:media destination), based off this post.

However, the images in my Drupal 7 nodes of which I'm migrating never had alt text. Therefore, I would like to use the Drupal 7 node title as both (a) the Media title and (b) its image alt text.

My files to media migration looks like this (a portion of it):

source:
  plugin: file_entity
  type: image
  constants:
    bundle: 'image'
process:
  mid: fid
  bundle: 'constants/bundle'
  langcode:
    plugin: default_value
    source: language
    default_value: "und"
  # name: filename
  uid:
    plugin: default_value
    default_value: 1
  status: status
  created: timestamp
  changed: timestamp
  field_media_image/target_id: fid
  # field_media_image/alt: field_file_image_alt_text/0/value
destination:
  plugin: entity:media

The commented out lines are what I'd like to use the node title (name and field_media_image/alt), but I'm not sure how to pull in the original Drupal 7 node title. Any suggestions are appreciated.


texts: How to print only src path of taxonomy image

texts:
I'm using Taxonomy image 1.6 on D6.19, I'm working on a legacy stack that I can't upgrade, nor do I have direct access to the taxonomy image module. Nice right?

Right now I'm using the taxonomy image in two ways, one is being printed out in the standard functionality of the mod and thats fine, the second is as a popup overlay created by jquery.

The popup is holding it's info in the "data-content" portion of a div, and required that any tag inside using only single quotes. Double quotes end the script early. I need to call the Src of the image so I can dynamically print it into an image tag. or I need to know how to hook into it so I can rewrite it for this particular use.

Any guidance would be welcome.
Thanks
Stephanie


texts: How to create a list of file fields with checkboxes selector?

texts:
We all know that by default drupal allows the users to create Lists consists of (float, integer, decimal and text) field types that can be useful for webforms element,
but this kind of list can't be very useful and haven't enough efficiency in content type (of course this is my personal opinion only) However,
I think this kind of list can be more flexible and powerful if combine with other types of field like Link and especially in the case of Files.
Because these kind of fields (Link & File) consists of two components Title (can be equal to field label For more convenience) that can be Stable and Value that can be Unstable.
for example I have a predefined, stable and limited list of title, List(text) and against of it there is a list of unstable and changeable of file fields in my custom content type, for this reason I decide to combine the power of lists (like default drupal list(text)) with file upload fields and create new and more powerful field type like List(file) something like below:

Advantages of this field:

Not have to change the Description (Title or label of the link) of file field eachtime that you want to upload or update a new file
Not have to change ugly file names like '102-32.exe' to something
can be more human readable.(If you want to use generic display format)
Get rid of any change or add more complexity to template files.


texts:
I'm editing views rows via ajax request. After request I expected refresh of this view.

I've added custom ajax command:

  Drupal.ajax.prototype.commands.refresh_view = function(ajax, response, status) {
        var selector = Drupal.settings.my_module.refresh_selector;
        $(selector).triggerHandler('RefreshView');
    };

but nothing happends. I'm debugging this and have sure that selector is ok.
Maybe this issue is because that Drupal.views.instances is empty?

What am I missing?


texts:
I want to list only parent terms in order to rearrange the orders like /admin/structure/taxonomy/vocabulary_name. Given url have displayed all terms included child terms. I want to avoid term terms. So i've tried to create custom page.
I've tried below code but i can't make it work.

function test_menu() {
  $items['manage_category/%taxonomy_vocabulary_machine_name'] = array(
   'title' => t('Manage category'),
   'page callback' => 'arep_manage_category',
   'page arguments' => array(1),
   'access arguments' => array('administer taxonomy'),
   'type' => MENU_CALLBACK,
 );
 return $items;
}

function arep_manage_category() {
  $category = arg(1);
  module_load_include('inc', 'taxonomy', 'taxonomy.admin');
  $taxonomy = taxonomy_vocabulary_machine_name_load($category);
  $form = drupal_get_form('taxonomy_overview_terms', 'taxonomy_term', $taxonomy);
  return drupal_render($form);
}

I've tried to access this page by vocabulary name. How ot make it work? Is any other idea?


texts: How to find operation type in validating form?

texts:
I have created a custom validate function for specific node form.

But validate rules are different between edit a current node or add a new node modes.

Now, I want to know, is there any way that we understand whether we are in edit mode or create mode in form_validate function ?


texts: Creating a file upload field with a translatable title attribute field

texts: I have a File field with the title attribute enabled and I'm trying to figure out how to make the title attribute field translatable using entity translations without affecting the actual file field itself. I'd prefer to allow users to upload one file with a title attribute that can be translated.


texts: Drupal sometimes doesn't save or delete node

texts:
I have experienced sometimes after few minutes spent on the edit page (to fill the form), I want to save or delete the node, it doesn't work. It redirect to the edit page without any notification or error message with the previous state of the node. (the modifications are gone) Then I do it again the same steps, same datas and it saves fine.

I have the same issue with creating new node. It's not frequent, pretty random.

Thanks for the helpful advices.


texts: Administration Theme switches to front-end theme

texts:
I am using administration theme "Seven".

When I clear cache or I work with some module and then I save its settings, the administration theme switches to front-end theme.

If i reload browsers current page, then the front-end theme switches back to the admin theme.

Is there any setting that can fix this?


texts: Can a content type have default input in fields

texts:
Is there a way for a user to add new content and have some of the fields already pre populated with default text/input.

That way the user can amend what changes are required for a node without having to copy and paste what will be very similar details into the add content screen node/add/[content type]?

Hope that makes sense.


texts: Flag- is there a way to allow users to only flag themselves?

texts:
I'm on Drupal 7 with Flag 2.0 (beta9).  The flag module provides a checkbox option for user flags, Users may flag themselves.  However, I would like to allow users to only flag themselves.  In other words, I want to give each user an on/off switch as a flag, but each user should only be able to toggle the switch for herself.

What I am trying to do: I have some options users select at registration (are you interested in A?  B?  C?  etc.)  These are checkboxes.  I want to give users an easy way to change these options after registering.  If I send them to the edit account screen, they get the option to change their password, e-mail address, etc., which is too much.  I was thinking of using flags to do this (with a rule that triggers to Set a data value when the user is flagged/unflagged), but it is crucial that users only be able to change their own values.


texts: Can't get hook_field_attach_view_alter to set the value of the field

texts:
I'm using some hook code I got from Drupal 7 show empty fields in order to show all of the empty fields on my node when viewing it. I would like to put a simple - as the displayed value when the field is empty.

function mymodule_field_attach_view_alter(&$output, $context) {
    // other stuff clipped...
    $output[$field_name] = array(
        '#theme' => 'field',
        '#title' => $instance['label'],
        '#label_display' => 'inline',
        '#field_type' => $field['type'],
        '#field_name' => $field_name,
        '#bundle' => $node->type,
        '#object' => $node,
        '#items' => array(),
        '#entity_type' => 'node',
        '#weight' => $display['weight'],
        0 => array('#markup' => '-'),
    );
}

I pulled the code from the linked page above and just changed the one line at the end that has #markup. As far as I can tell from the api docs, this code should work, but nothing that I put into that #markup value shows up.

All of the empty fields DO show up, it's just that the value shown is empty instead of - or blah or foo, because I've tried those as well. :)

How do I set the value to display when I use hook_field_attach_view_alter?


texts:
I have to develop a drupal site that allows authenticated users to create
personal profiles with data such as interests, personal details, educations, etc.

I created a profile2 type with all needed fields and organize the view of the
data with views3. I want to create a filter (search form) that allows other users and visitors to search the name (first- and last name in one "name" single textfield, an OR'ed query), the city, a proximity field as an addt. option if the zip code is entered (by probably using the location module) and also an additional field that searches thru various other profile fields in one single textfield (all fields OR'ed).

For that reason I thought it might be a good idea to create a views custom filter to build such search form and sql queries. I can not find any way using the regular filter criteria such the way I want it described above. For example, I do not get a single textfield for the OR'ed name query, etc.

The code skeleton I have up to now does not generate any filter entry in the criteria dialog at all. The filter modue is enabled in the modules section.
I have the strong feeling that the "hook_views_data()" is not defined the right way for "profile2 fields". I been looking at various filter examples, but found nothing profile2 data related.

Here is what I have up to now .. like said, just a skeleton I try to work out step by step.

xconsultantview.info

; $Id$
name = XConsultantView
description = Custom consultant filter
version = 7.x-1.x-dev
core = 7.x
dependencies[] = views
files[] = xconsultantview_handler_filter_profile.inc

xconsultantview.module

<?php

/**
 *
 */
function xconsultantview_views_api() {
    return array(
        'api' => 3,
        'path' => drupal_get_path('module', 'xconsultantview')
    );
}
?>

xconsultantview.views.inc

<?php

function xconsultantview_views_data() {
    $data = array();

    // consultant filter
    $data['node']['consultant_search_filter'] = array(
        'group' => t('Custom'),
        'title' => t('Eliteberater specific consultant filter'),
        'help' => t('Filter consultants on specific fields'),
        'filter' => array(
            'handler' => 'xconsultantview_handler_filter_view'
        ),
    );
?>

xconsultantview_handler_filter_view.inc

<?php
class xconsultantview_handler_filter_view extends views_handler_filter {

    function options_form(&$form, &$form_state) {
        parent::options_form($form, $form_state);
        // ...
    }

    function value_form(&$form, &$form_state) {
                // not quiet sure if this is needed here
        $form['xconsultantview']  = array(
            '#type' => 'textfield',
            '#title' => t('Term Name'),
            '#default_value' => NULL
        );

        return $form;
    }

    function expose_form(&$form, &$form_state) {
                // seems like here I should define my complete form
                // ...
    }

    function query() {
        $this->ensure_my_table();
                // ... sql query ...
    }

};
?>

As I already found out the hook_views_handlers() is no more needed in D7, because the include files are defined via the files[] in the module info file.

Can anybody shed some light on my question, if such custom filter in general is possible at all or if there are other more simpler solutions. My main problem of understanding lies in the hook_views_data() fct and the profile2 fields or if I have to define a subset of the profile2 fields, at least the ones that I need to filter.

Is there any example with an custom filter filtering profile2 fields in a view?

It is my first drupal project, so my in-depth knowledge at this time is quiet limited...

Thanks so much in advance for your help!


texts: Field in Field Collection not displaying

texts:
Running Drupal 7.59

I have added a field to a field collection using the Structure->field collections->(collection) menu

I edited a page where the field collection is used, and added content to the field.

The new field is retained when I revisit the edit page, but it does not show up in the field preview, nor when I display the current page.

When I add a field to the structure, do I need to do something else to enable display?

I have no idea how to go about debugging this!


texts: Group Views results by split year (academic, fiscal, etc.)

texts:
I have several content types with Date fields. I would like to build a View that groups that content by our academic year, e.g. 2015-2016, 2016-2017, 2017-2018, etc.

I realize I would have to define those start and end dates somewhere (i.e. August 1 through July 31). It could be similar to a fiscal year as well.

I could do taxonomy terms, but I was hoping to not have to introduce another field if the date fields can accomplish this.

I am using Drupal 8.


texts: How to discover events for event dispatcher

texts:
I want to write an implementation of EventSubscriberInterface for an event in commerce, there is a handy example, but

How do I find out what events are available (as a whole for my site) and/or
How do I know what events are getting hit on a request?

This question is not specific to the commerce module, it is just the context of my current problem.


texts: Print Drupal Statistics in node template?

texts:
When the (core) statistics module is enabled, we get a '50 reads' at the bottom of each node.

Is there any way I can pull that '50' (the node view count) and print it in a node template?

I want to accomplish this without a contribute module.

Any ideas?


texts: Validate username field in user registration form, drupal 7

texts:
I need to compare the text in the username field with the text in email field of the registration form. If they are not equal i want to stop the registration. I think i should use a hook but i really don't know where to start from.

Any idea?


texts:
I have Player (Entity) which is referenced on a Match (Content Type).

Now I'd like to Rate (from 0 to 10) the player for every match and get the average rating, can someone point me to the right solution.


texts:
I am creting a module with Drush integration. My challenge now is how to read the Drush config file in ~/.drush/myconfig.drushrc.php.

I tried drush_load_config_file but it is not working.

drush_load_config_file($context, _drush_config_file($context, 'deployment'));


texts:
I found a code in drupal page in this url http://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu_tree/6#comment-1073

code is

<?php
function phptemplate_menu_tree($tree,$menu_name="") {
     return '
'. $tree .'
';
}
?>

it is written that we can customize every menu by css and also adding $menu_name.

but even though that I have added this function into my template.php and it is working , $menu_name variable is always empty

really the target that I am following is :
I want to modify the css class of the ROOT us base on menu name.

for example for primary links , i want to have this return out put

'
'. $tree .'
'

or for secondary links i want to have this return output

'
'. $tree .'
'

$tree includes all nested li items from the selected menu.

please help me


texts: Admin permissions wiped out after git branching

texts:
I've encountered a strange issue whereby creating a new git branch on a Drupal 7 site and switching to it causes admin users' permissions to seemingly disappear. After performing the git branch, all admin users (who normally have near full access) see the admin toolbar but only have the ability to add content. All other links are missing.

I have tried visiting admin pages directly and that yields access denied. I have tried rebuilding permissions and clearing cache as well. Has anyone encountered this?


texts: What determines what "view" gets displayed first on a page?

texts: Lets say I have 2 views, that both need to be displayed on the same page and in the same content region. What determines which one gets displayed first over the other? I have looked around in the settings, but I can't seem to find them. I want to switch/flip my views around, but there doesn't seem to be a option to do this.


texts: Use entity relationship to exclude records on view

texts:
I have a content type, lets say PRODUCT
I have another type, PURCHASE, which points to PRODUCT with an entity reference

It is simple using views relationships to get PRODUCTS that have PURCHASE relationships, get totals, all kind of groovy things...

BUT

How do I get all PRODUCTS without any PURCHASEs? So create a view with a relationship "Entity Reference: Referencing entity" but exclude all those that are referenced by a PURCHASE?

Contextual filters have that nice negate checkbox, but that does not help me under relationships.


texts: Can I create a Selection Rule that uses a string against a Taxonomy Term?

texts:
I've got a Taxonomy Term template I wish to create a Selection rule with.

This uses a Taxonomy list as part of the content. For example, the Taxonomy list is about car makes so I have "Honda, Toyota, Mazda, Volkswagen, BMW, etc"

I want to make a selection rule where if any of the above brands are selected, it will display it's corresponding Taxonomy Term template, eg "Honda" will use the Honda Taxonomy Term template variation.

Currently, I've set this up and it works fine - In my Selection Rules I have added "Taxonomy Term car_brand" and have selected "Honda" (or whatever brand is applicable per template).

The problem is exporting these selection rules in a Feature - the database on my local is different to that on the remote server, thus my Taxonomy Term IDs (TIDs) change and the selection rules get messed up.

A solution I thought about would be to not use TIDs and use a string. However, the Taxonomy Term selection in Selection Rules only appears as a pre-populated drop down list.

Is there any way to use a textfield and string rather than select form a drop down list?


texts:
I've created a paragraph type called "text_icon_boxes". It has 19 fields. I've added this paragraph type to one of my content types.

What I'd like to do is customise the display of this paragraph type. I've created a twig template paragraph--text-icon-boxes.html.twig, but the fields display "-1", etc. How do I access the paragraph fields in this twig template?

Here's a small snippet:

{{ content.title }}

{{ content.text }}

The twig template is the right one. Twig template suggestions:


texts:
The Security advisories does not mention the usual classification for how critical this is (probably because it is about 3rd-party libraries). Can the whole site be compromised with this vulnerability or is it about accessing restricted content?

Ref.

https://www.drupal.org/SA-CORE-2018-005

https://symfony.com/blog/cve-2018-14773-remove-support-for-legacy-and-risky-http-headers