texts: Complex View Contextual Filter with User Relationships — how would I achieve this?

texts:
As I mentioned in the question I raised earlier this week, I'm using User Relationships to create unidirectional friendships between users on my site.

The friending paradigm is like Twitter, where Alice may follow Bob and that does not imply that Bob also follows Alice. That said, Bob is able subsequently to choose to follow Alice.

Looking in the database table user_relationships, I can see that this situation results in two rows for a reciprocated relationship:

mysql> select * from user_relationships where requester_id in (187767, 190348)
  and requestee_id in (187767, 190348);

+--------+--------------+--------------+------+----------+------------+------------+-------+
| rid    | requester_id | requestee_id | rtid | approved | created    | changed    | flags |
+--------+--------------+--------------+------+----------+------------+------------+-------+
| 200726 |       187767 |       190348 |    1 |        1 | 1331657565 | 1331657565 |     0 |
| 200723 |       190348 |       187767 |    1 |        1 | 1331656437 | 1331656437 |     0 |
+--------+--------------+--------------+------+----------+------------+------------+-------+
2 rows in set (0.00 sec)

For ease of discussion here, let's talk about a specific View — that of "users who follow you but you don't follow back". For these users, there will be a row in user_relationship with requestee_id being $current_user‑>uid, let's say this has a requester_id of $follower‑>uid. There will be no row, however where $current_user‑>uid is the requester_id and $follower‑>uid is the requestee_id (which would indicate that the current user had reciprocated by following back). So if we're looking at the output above, it would be the situation where only the first row (rid = 200726) exists, from the perspective of user 190348.

This is slightly easier to explain with a Venn diagram that I've hastily knocked-up:

; my View here is of the area labelled C.

Now in my View (of which there is a now out-of-date screenshot), I have two Contextual Filters:

"User relationships: Requester user", bound to the "requester" Relationship and set to Exclude; and
"User relationships: Requestee user", bound to the "requestee" Relationship, not set to Exclude.

So far so good. Except this shows me all users who follow $current_user, not just the ones that $current_user does not also follow back — B ∪ C. If I want to show only the users in C, then I also need to check that no reverse row exists. If I go to add a new Contextual Filter, I don't have any option to check something like this (as it is not a property of the individual row I'm showing).

So how do I achieve this? I guess I'm going to have to write some PHP to prevent displaying users where this is the case and there are custom modules in my site already, but I don't understand Drupal well enough to know what hook I'm looking for or where to intercept the processing of the rows being displayed.

Help, please?  :o)


texts: Securely deny direct access to nodes except when link on another node is clicked

texts:
I'm hoping there's a module for this.

Let's say I have two nodes. First one is supposed to be a "gateway" to the second one with protected content on it.  What I'm trying to do is make the protected node accessible only by clicking a link on the "gateway" node, and display an error message if they try to go any other way (direct link, browser history, etc.)

For example, in one method, we could set a session variable or database entry or something that has the following info:

Current user's ID
Page being accessed
IP address
Timestamp
Expiration (to prevent access by going to direct browser history)
Single use "key" to be checked by receiving page

Then, when the user clicks a link to protected content on the "gateway" page, it sets the above variables and passes the "key" to the protected page, which then looks up the other data based on that key and allows/denies access accordingly.

Is there a module that does this sort of thing or gets us close? If not, what would be the best way to write something that does this?


texts: How to debug: How Can I see the form arrays with its components (fields) in a loaded page?

texts:
I would like to changing a title of a button in a form, and I would like to have a tool for debug, like devel or another, so I can see in real time, after a page is loaded, what is the structure in forms, subcomponents, name of every field.

So I know how could add a line to the code in my custom module to change the title of a form button.

How would you do it? Steps, method, tools, please share.

Note: These are my first steps in programming modules, changing simple things for now.

Thanks for your suggestions!


texts: How to get the node ids of answers for a question in Drupal Services (REST)?

texts:
I have a Drupal setup that is currently having a question and answers module.

I am able to read the question and answers by accessing http://mysite.tld/rest_endpoint/node/{nodeid} . However when I access a question, I am not able to get the nodeIds of all the answers to that question.

So I am looking to get the Node Ids for all the answers for a specific question.

What params/filters do I need to use in the Drupal Services GET call? I have services module.
Can I achieve this by doing a database query? I am not able to find a link between questions and answers in the DB too!

Any suggestions?


texts: Display webform results data in a Google Chart

texts:
I'm trying to display webform results as Google Charts. I'm doing this on the theme layer by overriding theme_webform_results_analysis() on my theme's template.php file and using the Chart module. Drupal 6.22, Webform 6.x-3.11.

The webform analysis page normally shows the data in a table, so I'm trying to hack apart the arrays for that table to pass stuff into the Chart API.

EDIT: I figured out how to use var_dump and found that the better approach might be to get up in the $row_data and $questions arrays separately (instead of using the $rows array that I had in the first version of this question, which was a mashup of both arrays).

EDIT #2: I think I've discovered how to grab each piece of the original $questions and $row_data arrays (see below - the foreach in the other foreach). So now I need to get those pieces into proper arrays (1 per question) and find a way to iterate through all of those.

Here's what I've got in template.php:

/**
 * Output the content of the Analysis page.
 * @see webform_results_analysis()
 */
function mytheme_webform_results_analysis($node, $data, $sids = array(), $analysis_component = NULL) {

  foreach ($data as $cid => $row_data) {

    if (is_array($row_data)) {

      // get the questions, put them in an array
      $questions = array();
      $questions[] = array('data' => check_plain($node->webform['components'][$cid]['name']));

      // this will print everything out in the right order - it really needs to
      // make an array for each question that looks like $test_chart below
      foreach ($questions as $question) {
        print $question['data'] . '
'; // questions
        foreach ($row_data as $key => $value) {
          print $value[0] . '
'; // labels
          print $value[1] . '
'; // results
        }
      }

      // Set up the chart
      $chart = array(
        '#chart_id' => 'webform_analysis',
        '#type' => CHART_TYPE_PIE_3D,
        '#size' => chart_size(658, 250)
      );

      // not real data here, this just shows the format I'm shooting for
      $test_chart = array(
        'option 1' => '12',
        'option 2' => '45',
        'option 3' => '122'
      );

      // separate the above array into labels and values, add a percentage to the label
      foreach ($test_chart as $key => $value) {
        $chart['#data'][] = $test_chart[$key];
        $chart['#labels'][] = strip_tags($key) . ' (' . round($test_chart[$key], 2) .  '%)';
      }
      // pick some colors
      $chart['#data_colors'][] = 'b0c73d';
      $chart['#data_colors'][] = '667323';
      $chart['#data_colors'][] = '221f1f';

      $output = chart_render($chart);
    }
  }

  if (count($row_data) == 0) {
    $output = t('There are no submissions for this form.');
  }

  // return the data that goes into chart function, just for testing
  // return $chart_data;

  // someday, this might return a set of webform charts. right now it returns the fake test chart
  // return $output;
}


texts:
I'm working on a D8 project trying to add custom access rules to some pages.

I want to restrict access to specific users based on their id.

I checked this and seems easy but I can't make it work!

I want to change the access for the route

  entity.webform_submission.canonical
  /admin/structure/webform/manage/{webform}/submission/{webform_submission}

But as I didn't manage to make it work I tried an easier example

  contact.site_page
  /contact

(Which also doesn't work)

So I created my routing file under my_module/src/Routing folder :

namespace Drupal\my_module\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route_item = $collection->get('contact.site_page')) {
      $requirements = $route_item->getRequirements();
      unset($requirements['_permission']);
      $route_item->setRequirement('_access', 'FALSE');
    }
  }
}

After that I added the service file in my_module's root folder:

services:
  my_module.route_subscriber:
    class: Drupal\my_module\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }

But I don't get Access denied when I visit those pages.

Also, is there any way to test it by using dsm or var_dump?

Any idea/help/suggestion is valuable!

Thank you in advance.


texts: How can I insert a block into each page of a view if the page is loaded via ajax?

texts: I am trying to insert a SimpleAds block for each page of a View. But pages are loaded via AJAX using infinite pager. How can I insert a SimpleAds block into each dynamically loaded page of results?


texts: What is the proper syntax to call the theme function for a node, passing an argument?

texts:
I'm writing a Drupal 7 application that has many content types. Each of these content types has a custom template for display. For instance, I have node--event.tpl.php, node--person.tpl.php, node--feedback.tpl.php, and so on.

I'd like to be able to manually call a theme function on a node that should have an overriding template. i.e. something like the following:

<?php print theme('node', array('node' => $node)); ?>

The reason for this is that I've written a module called Content Inclusion which allows pieces of content to be manually included within one another. I'm trying to have this line of code in my node.tpl.php file to automatically display the included node along with the parent node.

I appreciate any and all suggestions, but I would be more interested in learning about ways to make this work - this module has some very specific requirements that existing modules were not able to address. Thanks.


texts: How can I hide the title in my user registration form?

texts:
I am using LoginToboggan module. And I want to hide the title.

As you see in first picture "Log in" title is shown, and in second "Create new account" title is shown. How can I hide these titles?


texts: Search Results Templates Strange Cacheing Behaviour

texts:
I've been trying to resolve an issue with my search results templates.

There are two scenarios that I could really use some help with understanding:

I have no search result templates inside my theme, just using the default system ones. I'm manipulating their variables to control output in template.php using hook_preprocess_search_result(). This is fine and displays exactly how I want it, until a few hours go by and all of a sudden it seems as through the preprocess function is ignored and the results revert back to their default appearance.

I can fix this by clearing the cache, and sometimes it takes a couple of clears.

I have search results templates within my theme. This time a similar thing happens which seems to involve the cache but rather than reverting to the default appearance after a few hours, the results disappear altogether. Strangely, the pagination links are still displayed normally, and I can move through the pages of results, but no results are output.

Ideally I'd like to use the 1st approach i.e. just using the preprocess function.

I have the search restrict module installed but I've ruled that out by disabling it.

I've also tried the cache exclude module and configured it to just exclude search results pages but again to no avail.

Could anybody shed any light on this problem? Am I missing something obvious?


texts: Setup for Taxonomy throwing 404 constantly

texts:
I'm running a fresh, vanilla install of Drupal 7.27. There are absolutely no non-default modules installed with it. I was playing with the taxonomy settings to familiarize myself with the system. I have no trouble creating vocabularies, terms and hierarchies, or associating content, but editing any of my existing terms takes me out of the overlay mode, and saving the edits throws a 404 Object not Found. Further, setting urls for any of my taxonomy terms breaks the landing page for the term, giving me, for example:

Page not found
The requested page "/drupal-7.27/?q=/nonfiction/cookbooks" could not be found.

in the content area of the page.

Any ideas where I can look for the source of this error? The error log in admin reports simply tells me what I already know.

I'm new to Drupal, just hoping to get my company to migrate away from Magento, so this is all very exciting, but confusing. Thanks in advance.


texts:
Recently started working on some JavaScript tests by extending JavascriptTestBase in drupal 8.2 and the biggest problem currently is debugging.

Phantomjs is installed and i have no problem running JavaScript tests. Xdebug is installed too.

$this->getSession()->getScreenshot();

is not returning any output, maybe some additional configuration is needed?

file_put_contents('/Users/me/debug.html', $this->getSession()->getDriver()->getHtml('/html/body'))

is giving me a half broken page.

I would really appreciate if someone can share how they debug these tests and how they set it up, some useful links. The biggest help would be to be able to take screenshots but any info on this topic is welcome.


texts: How to create a translation and get author and post date copied from the original node

texts: When creating translations of news I want them to have the same author and post date as the original node, so that I (or the translator) don't have to copy paste. Anyone know a module or snippet for this?


texts: How to token Insert nth element of Iframe?

texts:
Module used: Token Insert

I have a content type with an iframe field which accepts multiple values.
In my wysiwyg body field, I did a token insert.
When I add this iframe field which has only one value with token insert, it works perfect.

What to do if I want to insert only the second/third value of the multi value iframe field? Any help would be highly appreciated.

Basically I want to have control on which video to insert from the multi value iframe field.

Name of the field is Microsoft Video. So I took the token first and added delta as suggested below. [node:field_microsoft_video:1] This is printing the value as plain text after giving the delta.


texts: How can I redirect users on login based on their chosen language?

texts:
I'm looking to redirect users after they login.

The site is multilingual, using English and French.

I've tried using the Login Destination module and using Rules, but it has no options for accessing the language the user has chosen.

On the user edit page, the user can select 'English' or 'French' as their language.

I'm looking, ideally, for a simple rule condition to add, or some PHP.

None of the answers I've found so far have mentioned multilingual sites.

Thanks.


texts:
I want to be able to send the safe_key through the internal email.
The website was doing this before, and for some reason is not any longer.

I've tried %value[safe_key] and %safekey.
I read some information here, but no one seemed to have an answer that worked.
Is there another token that works? I saw %email[key] but was not sure that it would map right.


texts: How can I prevent text areas from being resizable?

texts:
Text areas in Drupal 7 are resizable by default.  I would like to turn this off, but when I checked a text area with Firebug, I couldn't find the CSS that was making it resizable.

How can I prevent text areas from being resized?


texts: Views Exposed Filter conflicting with default search

texts:
When I'm on a page with an exposed filter and then go to type into the default search, clicking the search button brings me right back to the exposed filter.

For now I am hiding the search block on that page but I would like them to both be on the page.  Is there anyway to fix this?


texts: Revert back to the previous dev version of a module using composer

texts:
Current last dev release of the Field Group module for drupal 8 was out on (29 Mar 2019).
However, I need to download the previous dev version before the dev version release mentioned above.

The last dev release was out on (29 Mar 2019)

but I need the previous dev version which was out on (10 May 2017)

It is important for me to record this specific dev version in composer.json file so the same dev version of the module will be used on all environments.

How can I do that ?

Note: i can use any of Composer, Git or Drush commands.


texts: How do I set up Search API index as cron task?

texts:
From what I've read in Search API's settings, it sounds like pages should be indexing when cron is ran. This doesn't seem to be the case, but perhaps my logic is flawed.

I help manage a blog/news site. All of the content is indexed through search API, and I'm rendering lists of that indexed content using Views. One View display renders a list of the site's most popular content. This is calculated using the Statistics module. You can see here that I'm sorting this view using the Number of views field:

Initially, I didn't think that the sort criteria was working at all. I added the Number of views to the rendered output for testing, and found that the pages weren't being reordered when the page views changes.

However, I eventually discovered that the nodes will reorder, only after Search API is reindexed manually. Currently, Search API is set to index nodes immediately upon publishing, but I'm assuming that a full reindex does not occur when this happening. I tested this by creating a new node, and found that the order of nodes did not update. I've also run Cron manually, and have found that this does not work either.

Now, I'm of the impression that Search API is not reindexing when running Cron, but I'm unsure if this is a valid assumption. If it's not, I'd like to set up a nightly reindexing. How do I go about writing this cron task?


texts:
I have 2 modules (filters): html_pre_filter and syntaxhighlighter.

syntaxhighlighter_prepare_callback executes before html_pre_filter_prepare_callback.

How to reoder them?

I tried this

function html_pre_filter_module_implements_alter(&$implementations, $hook)
{
    if($hook == 'filter_prepare')
    {
    $group = $implementations ['syntaxhighlighter'];
    unset($implementations ['syntaxhighlighter']);
    $implementations ['syntaxhighlighter'] = $group;
    }
}

but it doesn't work


texts: Drupal Commerce add to cart is no longer working for anonymous users

texts:
I just updated to Commerce Kickstart 7.x-2.52 and add to cart is no longer working for anonymous users. It shows the success add to cart message but nothing is added to the cart. If I log in it works fine. I’ve tried:

I checked out and UID 0 is still in the DB
Disabled honeypot module
emptied the cache_from table
enabled “disable SQL rewrite” on the cart view
check permissions for the anonymous user
cleared the cache

UPDATED
The order entity is being created but nothing shows in the cart.


texts:
I am trying to create a view that will count the number of submissions that a particular webform has.

So far I have added the field:
Webform: Webform submission count

and added in a Node:ID filter to the ID of my webform.

When I preview the webform it works fine, however when I place the view on my front page it returns 0 results.

I am thinking this is because anonymous users don't have permissions to access submissions? Which I don't particularly want them to anyways.

The field also links to the submissions page of my form, which I don't want it to do either, i just want text there. I have checked the settings and there is nothing to say that the field should link to the submissions.

Bottom line, how can I create a view or perhaps if there is a count module, that will show the number of times a particular form on my site has been submitted?

Thanks! :)


texts: Auto-Fill from on content type to another

texts:
I have a content type called Point-of-Contacts, basic info for a person. (~600 nodes)

I have another content type, like a form, that has a select list of all Points-of-Contacts.  When a user selects their desired Point-of-Contact, by name from the select list, I need the rest of the info of that Point-of-Contact to auto-fill text boxes on the form.

Any ideas?

NOTE: Using Drupal 7


texts: overriden term name not translated on a taxonomy overriden views page

texts:
I'm using Title module with Entity translation to translate my taxonomy terms.
I have overridden my term page with a view with term id as contextual filter.
In the contextual filter section, I'm overriding the title view page with the contextual filter %1.
I'm validating the contextual filter by checking if it's a term id.

Unfortunately the title page is not translated. In my case term name displayed is always the one in English.

Just to test further, if I'm adding 2 fields term name and term description to my views. The 2 fields are correctly translated, by switching languages.


texts: "one more" ajax call for multiple node add forms on one page

texts:
I want a page with an initial node add form (in small size), the title line and body textarea 3x20 size;

And a button "one more" with ajax call to display another form plus another button etc etc.

and of course the submit button always at the bottom.

So the question is ... which module ? :) I hardly cant find the terms for searching!

UPDATE: I want to add , this task seemed to me quite often used and modular, so I thought there would be a module for it; Now as i work through related questions and learn about ajax form api http://randyfay.com/ajax it's okay to code it for me and maybe you can give some starting points.


texts:
How to prevent double form submission in drupal
when i create basic page and click submit 10 times.. then node create 10 times of same content

please suggest me, how to prevent


texts: Determine whether module is enabled / disabled

texts:
I am trying to write a Drush script to enable a bunch of modules based on a hook. If it's already enabled, I would rather skip enabling that module.

Is there a way for Drush to return whether or not a module is enabled?


texts: Overload permissions for specifics users

texts:
On my website, I have users with classic roles, but I want to add the possibility to assign permissions to specifics users. For example, a user has a role that doesn't allow the user to create articles, but I want to have a checkbox (on the edit page of the user's account) to grant this permission (and not to all users that have this role). Of course I can't create a specific role for that because I'm talking of many permissions specifics to users.

How can I perform this ?


texts:
When I reference a view name and/or view name with contextual filters in the menu Path for child menu items, they do not stay expanded on display of the view page.

I had this solved on another site, but for the life of me, I can't remember how I did it.

I don't want the expanded flag set force it always open. The only menu module I have loaded is Menu Attributes.


texts:
I have a content type called: Activity. Then I have a role called: Gestor
In /admin/people/permissions I make sure I checked (for the Gestor role):

Activity: Create new content

Activity: Edit own content

Activity: Edit any content

Activity: Delete own content

Activity: Delete any content

Now I login with a Gestor user role and tried to go to /node/add/activity and I get ACCESS DENY

The content type has the defaults fields: body and title.

I already rebuild permission at: /admin/reports/status/rebuild but not working...

UPDATE
*If I check Bypass content access control I get access to fully manage ALL content type*


texts: 8.4.4 CKEditor Link & Unlink Buttons suddenly missing

texts:
In Drupal 8.4.4 the CKEditor is suddenly missing the Link and Unlink buttons for all content types, for the Basic Editor and the Full HTML Editor as well.  My users and I can no longer add links to anything, and if I edit articles any link html disappears in the editor altogether (I noticed the issue after editing and saving an article and then noticing the links that were there moments before were suddenly gone).

I went to admin/config/content/formats to configure the editors to add the buttons back, but when I click the Configure button for Basic HTML I get the dreaded "The website encountered an unexpected error. Please try again later." message.  Drupal error log shows the following:

  TypeError: Argument 1 passed to Drupal\Core\Render\Element::children()
  must be of the type array, null given, called in
  /core/modules/ckeditor/src/Plugin/Editor/CKEditor.php on line 177 in
  Drupal\Core\Render\Element::children() (line 71 of
  core/lib/Drupal/Core/Render/Element.php).

  Drupal\Core\Render\Element::children(NULL) (Line: 177)
  Drupal\ckeditor\Plugin\Editor\CKEditor->settingsForm(Array, Object,
  Object) (Line: 64)
  Drupal\editor\Plugin\EditorBase->buildConfigurationForm(Array, Object)
  (Line: 175) editor_form_filter_format_form_alter(Array, Object,
  'filter_format_edit_form') (Line: 501)
  Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object,
  'filter_format_edit_form') (Line: 830)
  Drupal\Core\Form\FormBuilder->prepareForm('filter_format_edit_form',
  Array, Object) (Line: 272)
  Drupal\Core\Form\FormBuilder->buildForm('filter_format_edit_form',
  Object) (Line: 74)
  Drupal\Core\Controller\FormController->getContentResult(Object,
  Object) call_user_func_array(Array, Array) (Line: 123)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
  (Line: 582)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
  (Line: 124)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array,
  Array) (Line: 97)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
  call_user_func_array(Object, Array) (Line: 153)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line:
  68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
  (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
  (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object,
  1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line:
  78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
  (Line: 50) Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1,
  1) (Line: 50)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1,
  1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line:
  657) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I don't know if this is related to recently updating Drupal to 8.4.4, but I was not encountering this issue before as I've made many articles in the past month with links that still work.  I have no idea how to debug or fix this issue, or if it's a known bug, please any help is appreciated.


texts: Restrict access to ECK full page, but allow embedded

texts:
Following the Lullabot article on how to embed anything in a wysiwyg with Entity Embed and friends  we're using this to embed a custom entity type created with ECK (Entity Construction Kit).

The permissions for ECK require anonymous users have the "View My Entity" permission in order for it to appear in the embedded scenario.  However  ECK also provides a full page URL at /my_entity/{id}, but we want to restrict access and not index the full page, because the content will always be embedded inside other Articles.

I've already implemented the Metatag module for this entity to add the robots noindex meta tag. However the ideal case would be to restrict the ECK full page URL /my_entity/{id} to administrators only. How can this be done, when these entity types are dynamic and don't have a canonical route.


texts: How do I change a field with hook_node_presave()?

texts:
In Drupal 7, I was using hook_node_presave() to update some hidden fields in a node.

function mymodule_node_presave($node){
    if ( CONDITIONS ) {
        $node->field_fieldname['und'][0]['value'] = importantfunction();
    }
}

In Drupal 8 I cannot do the same thing. Looking into the object I tried this:

function mymodule_node_presave($node){
    if ( CONDITIONS ) {
        $node->values['field_fieldname'][0]['value'];
    }
}

It won't work though. I am aware that a lot have changed in Drupal 8 and I am studying it, but I did not find an answer to this yet.


texts:
On ServerFault, this question "Ending company IT Admin relationship" has a pretty good general checklist for taking over an existing IT system, but I'm wondering as it relates to Drupal:

What system access controls should I get, or confirm have been changed after the takeover?
What is the most effective way to assess the scope of existing custom configurations, development, etc done?

If it matters, the existing site is on Drupal 6, but talking about porting the site from 6 to 7 is beyond the scope of this question.


texts: how to develop features delivered by drupal if there is no cms

texts:
I'm quite familiar with drupal, had done a few projects using drupal. I had an interview where the interviewer asked a few unexpected questions (atleast for me they were like unexpected!!). Few of them were

  How do you develop the same features that you did, if there is no CMS
  (Drupal)?

  What tables/scheme (mysql) do you create to generate all possible
  fields??

  If you are going to attach a pdf file (corresponding to each record)
  where do you specify that pdf file, do you use sql table or else
  what??

These were a few questions that I couldn't explain with full confidence.

I didn't even thought of the process behind drupal. I just used to work with my requirements and needs, I never thought of what the process might be. And more specifically with sql.

Do any of you have any views?


texts: how to extend FormBuilder::processForm from multiple API endpoints in one class

texts:
I'm trying to consolidate my form processing by entity_type, without rebuilding the forms (just using the default forms provided by Drupal.

I have dynamic routes pointing to a _controller::method. I've tried:

A. \Drupal::service('entity.form_builder')->getForm($group_content, 'edit', $data) but this just returns a render array, no instance.
B. \Drupal::formBuilder()->getForm('\Drupal\group\Entity\Form\GroupContentForm') but this is the wrong class path and i can't figure out how I could reference any entity:bundle:id by any pattern (i've tried many)
C. Changed the route to use _form or _entity_form extending FormBase (instead of a controller), but it seems these require the buildForm method to defined the form's full field list (which defeats the purpose of my question).

What is the best approach to expose edit/add/delete process handlers for multiple bundles / entity_type in a single class?


texts: Using one exposed filter on different date fields

texts:
So been looking at this for a bit now and nothing springing to mind so question and advice needed. On Drupal 8.

What I want:
I have a content type with three date fields (Date A, Date B and Date C). Using a view I can create an exposed filter to filter dates between ranges, before, after, etc on say Date A. I can do the same for the other date fields.

I would like to restrict it to one date field at a time. So select the dates for Date A OR Date B OR Date C but never more than one date field.

Question
Sounds simple. I cannot find a simple way to do this so unless I have missed the obvious am going to have to create a module. Before I look into that and start the ball rolling are there any existing solutions I have missed?

Assuming there is no easy way my thought was to create a new module.This would allow one date input and then a select box to choose which field to perform the operation on.

I have not yet looked at this in depth so as to using JS/AJAX to achieve this or a PHP solution (Class or hook), I am open to suggestions.

Thanks


texts:
I'm new to Drupal and here is the requirement - There is a page that has a field (Doc link) of type Link. I give the URL of the Doc link field as /sites/default/files/docs/file1.html.
Now when I click on this Doc link field it shows the entire folder structure of file1.html in the web browser. I don't want users to see the actual path where file1.html is stored. I want to be able to mask/hide this URL in the web browser.
So instead of displaying https://xyz.com/sites/default/files/docs/file1.html I want to display a generic link - https://xyz.com/docs/latest/file1.html. Is there any module that I could use to achieve this?


texts: How do I resolve this installation error?

texts:
I am getting the following error while installing Drush with composer require drush/drush.

  Using version ^8.1 for drush/drush
  ./composer.json has been updated
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Your requirements could not be resolved to an installable set of packages.

  Problem 1
  - drush/drush 8.1.0 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.1 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.2 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.3 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.4 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.5 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.6 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.7 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.8 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - drush/drush 8.1.9 conflicts with drupal/drupal [No version set (parsed as 1.0.0)].
  - Conclusion: don't install drush/drush 8.1.12
  - Conclusion: don't install drush/drush 8.1.11
  - Conclusion: don't install drush/drush 8.1.10
  - Conclusion: don't install drush/drush 8.x-dev
  - Installation request for drupal/drupal [No version set (parsed as 1.0.0)] -> satisfiable by drupal/drupal [No version set (parsed as 1.0.0)].
  - Conclusion: remove phpdocumentor/reflection-docblock 3.1.1
  - Installation request for drush/drush ^8.1 -> satisfiable by drush/drush [8.1.0, 8.1.1, 8.1.10, 8.1.11, 8.1.12, 8.1.2, 8.1.3,
  8.1.4, 8.1.5, 8.1.6, 8.1.7, 8.1.8, 8.1.9, 8.8.x-dev, 8.x-dev].
  - Conclusion: don't install phpdocumentor/reflection-docblock 3.1.1
  - drush/drush 8.8.x-dev requires phpdocumentor/reflection-docblock ^2.0 -> satisfiable by phpdocumentor/reflection-docblock [2.0.0,
  2.0.0a1, 2.0.0a2, 2.0.0a3, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.0, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.0a1, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.0a2, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.0a3, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.1, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.2, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.3, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.4, 3.1.1].
  - Can only install one of: phpdocumentor/reflection-docblock [2.0.5, 3.1.1].
  - Installation request for phpdocumentor/reflection-docblock (locked at 3.1.1) -> satisfiable by phpdocumentor/reflection-docblock [3.1.1].

  Installation failed, reverting ./composer.json to its original
  content.


texts: How to render a field above the node title using omega sub-theme

texts:
I am trying to render a slideshow in a node above the page title

So far I have in my template.php

function MYTHEME_preprocess_region(&$vars) {
  $theme = alpha_get_theme();
  if ($vars['elements']['#region'] == 'content') {
    $vars['node'] = $theme->page['node'];
  }
}

this passes a $node variable into a custom region--content.tpl.php
I was then expecting to be able to use this snippet to render the field but it fails

print render($node['field_slideshow_images']);


texts:
my module main_module adds an entity my_entity and a field the_field that has

'entity_types' => array('my_entity')

main_module also has this:

function main_module_field_attach_create_bundle($entity_type, $bundle)
{
    if ($entity_type == "my_entity"){
        field_create_instance(
            array(
                'field_name' => 'the_field',
                'entity_type' => 'my_entity',
                'bundle' => $bundle,
                'label' => 'Users',
                'required' => TRUE,
                'widget' => array(
                    'type' => 'options_select',
                ),
            )
        );
...
}

another_module (dependent on main_module) adds a bundle of my_entity, and therefore automatically gets the field instance.

the problem is that when i uninstall another_module, I call
entity_delete('my_entity', $key_of_bundle) ;

which removes the instances (OK) but also the fields themselves which mean I need to reinstall main_module in order to get them back.

thanks


texts: I am using the Views module for multiple sections of my site.  I have added a custom view for displaying results of a taxonomy term. The taxonomy term is 'resource-topics'. The view is set up with a path setting '/resource-topics/%'.  I have added a custom template to use for these pages and when I go to the url /resource-topics/all...it uses my custom template, but when I go to an actual taxonomy term, such as /resource-topics/term-name it just shows a random list of content that matches the taxonomy term without using my custom template.  How can I get the taxonomy terms to use my View?


texts: file_save_data() cannot save to private://

texts:
I have to write a custom module extension, that saves entityform submission after hitting submit button to a PDF file in the private://pdf/<file_name> uri.

At first step it generates the PDF file to a temp directory via TCPDF and then I try to use file_save_data to save it to private directory and upload the file data to the db.

When I upload the file to the public directory, there are no problems, but when I set the uri to private://<pathname/filename> it sends me an error message:

  "The data could not be saved, because the destination is invalid. More information is available in the system log".

In the system log:

  "The data could not be saved because the destination private://pdf/employee_aontest_richie_2014-06-03_00_00_00_59.pdf is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper."

The code, that should save the whole thing is this:

$title = $node->title; // TCPDF doesn't let you have spaces or colons in your file name
$title_exploded = explode(' ', $title);
$title_imploded = implode('_', $title_exploded);
$imp_exploded = explode(':', $title_imploded);
$imp_exp_imploded = implode('_', $imp_exploded);
$real_title = drupal_strtolower($imp_exp_imploded);
//end of title generation
$save_path = 'private://pdf/'.$real_title.'.pdf';
$handle = fopen($full_path_tcpdf_output, 'r');
$file = file_save_data($handle, $save_path);
fclose($handle);
unlink($full_path_tcpdf_output);

I think the file saving procedure should work this way as it works if I save to public.

I appreciate any further advices.


texts: Menu_block module on dashboard gives notice error which won't go away

texts:
I'll installed the drupal block_module on my website, it works perfectly. Yesterday i decided to add this same block_module to drupals dashboard. Then all suddenly i got the following errors.

I iknow this is probably an issue of menu_block module or the dashboard or drupals core. How ever, i decided not to use the block_module for this purpose anymore. But even after deleting the block_module from the dashboard, i still recieve this errors.

I flushed all cache etc, but nothing seems to change... Can anyone suggest how to get rid of these nasty errors...

Notice: Undefined index: block-4-2 in menu_block_view() (regel 486 van C:\xampp\htdocs\website\modules\menu\menu.module).
Notice: Undefined index: block-4--2 in menu_block_view() (regel 486 van C:\xampp\htdocs\website\modules\menu\menu.module).
Notice: Undefined index: block-4-2--2 in menu_block_view() (regel 486 van C:\xampp\htdocs\website\modules\menu\menu.module).
Notice: Undefined index: block-4 in menu_block_view() (regel 486 van C:\xampp\htdocs\website\modules\menu\menu.module).
Notice: Undefined index: block-4-2 in dashboard_page_build() (regel 192 van C:\xampp\htdocs\website\modules\dashboard\dashboard.module).
Notice: Undefined index: block-4--2 in dashboard_page_build() (regel 192 van C:\xampp\htdocs\website\modules\dashboard\dashboard.module).


texts:
My goal is to pipe mail with Postfix into a drush command. I made a simple bash script that redirects stdin to the drush command, and I configured Postfix to pipe mail to the script. But executing drush from the script does not work, as it cannot connect to the database. I assume there is some environment/bootstrapping missing but I cannot figure out what.

Bash script, postfix-filter.sh:

#!/bin/bash

# Enter Drush environment
cd `dirname $0`

# Redirect stdin to Drush command, log any ouput
/usr/local/bin/drush my-command <&0 &> my_command.log

Running the script from terminal works fine:

$ ./postfix-filter.sh < test.eml

But when triggered by Postfix receiving a mail, the following is printed to the log file:

The drush command 'inmail-process' could not be found.  Run `drush       [error]
cache-clear drush` to clear the commandfile cache if you have
installed new extensions.
Drush was not able to start (bootstrap) the Drupal database.             [error]
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        :  8.0.0-dev
 Site URI              :  http://default
 Database driver       :  mysql
 Database hostname     :  127.0.0.1
 Database port         :
 Database username     :  root
 Database name         :  drupal
 PHP executable        :  /usr/bin/php
 PHP configuration     :  /etc/php.ini
 PHP OS                :  Darwin
 Drush version         :  7.0-dev
 Drush temp            :  /tmp
 directory
 Drush configuration   :
 Drush alias files     :  /Users/mdi/.drush/aliases.drushrc.php
 Drupal root           :  /usr/local/var/www/d8/www
 Site path             :  sites/default
 Active config path    :  sites/default/files/config_FTG0_Sy-OJ0Mco
                      1c4ZlOBwJ3Ia-sMX0PcQiIiaGcsRufMWfFBWwSWLu
                      lhB83nL0hF9Dl9Y24-w/active
 Staging config path   :  sites/default/files/config_FTG0_Sy-OJ0Mco
                      1c4ZlOBwJ3Ia-sMX0PcQiIiaGcsRufMWfFBWwSWLu
                      lhB83nL0hF9Dl9Y24-w/staging

As you can see from the output, I have already tried setting the database host to 127.0.0.1, as suggested by various discussions I found.

Any ideas on what is missing?


texts: Output the term title on page--custom.html.twig

texts:
I'm pulling my hair out trying to create a custom page--custom.html.twig for a content type and getting taxonomy terms to display.

I'm currently using the following piece of code:

{% if node.field_work__services.0 %}

      {% for key, item in node.field_work__services %}

{{ item.title }}

      {% endfor %}

{% endif %}

The if statement resolves, so I get a UL with an equivalent number of LIs to the number of taxonomy terms for that node... however, I can't get it to output the actual taxonomy term.

Anyone have any idea how to do this?


texts: Theme based altering of default image-style for the same node-type and view-mode

texts:
OK, After some research and since Domain_views module seems to be a little bit buggy (printing always default Domain ID no matter what), I think this is the base question solving my problem the other way around with 2 domains and 2 themes using the same nodes from same node-type, but they both need different image-styles because of their 2 different themes:

How do I alter the given image-style of a given node-type in its default full-node view-mode in the .tpl files of a theme, to have 2 different used image-styles in 2 different themes by the same node-type and the same view-mode?

I've tried to find example themes doing it and I heard of Entity view mode to add custom view modes, but I am still not sure if I am on the right tracks. Actually I only need another image style (size) for the same node-type and the same view mode but in 2 different themes since Domain Access gives me hard times to solve this with conditional view modes or Views displays.

From what I understood there are 2 ways:

a custom view mode for the same node type and a function in the theme telling the node-type to rather use this view mode
or only a image-style altering in the node--full.tpl.php but I can't find a good example explaining it.

The very basic question to research for me is: how to alter image-styles in the code of the theme layer? Is this correct?

Any help would be very appreciated! Thank you very much for any hint.


texts: Updating existing products via Drupal Migrate

texts:
I have 2 migrate classes - ProductsNewMigrate and ProductsUpdateMigrate.

1) ProductsNewMigrate runs initially, adding products from a CSV file into Drupal.  I can confirm this works correctly, the new products are created and a migrate map is set up in the database.

2) ProductsUpdateMigrate is required to import another CSV (exactly the same structure as in 1.) but with the updated product data originally migrated via ProductsNewMigrate.

I just can't get the Update migrate to work.
I receive the error:
array_flip(): Can only flip STRING and INTEGER values

When looking at the migrate map table for this Migration - migrate_map_productsupdate..
I notice sourceid1 is set to the SKU - which is correct.  However, destid1 and destid2 (product_id and product_revision respectively) are both null values - which could be causing this?

Edit: Also receive the warning message: "product_id" was used as destination field in "sku" mapping but is not in list of destination fields when viewing the migrate page!

See the code below:

Code:

class ProductsUpdateMigration extends CustomMigration {
  public function __construct() {
    parent::__construct();
    $this->description = t('Import new products from CSV');

    $csvfile = "/drupal/products_updated.csv";
    $columns = array(
      0 => array('sku', 'Product SKU'),
      1 => array('title', 'Product title'),
      2 => array('colour_specific', 'Product colour specific'),
      3 => array('price_group', 'Price Group'),
      4 => array('composition', 'Product Composition'),
      5 => array('width', 'Width'),
      8 => array('price', 'Product Price'),
    );

    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'sku' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'description' => 'SKU/newref',
          'alias' => 'p',
        )
      ),
      MigrateDestinationEntityAPI::getKeySchema('commerce_product')
    );
    $this->source = new MigrateSourceCSV($csvfile, $columns, array('header_rows' => 1));
    $this->destination = new MigrateDestinationEntityAPI('commerce_product', 'blinds');
    $this->systemOfRecord = Migration::DESTINATION;

    // print_r($this);

    // Mapped fields
    $this->addFieldMapping('product_id', 'sku')
      ->sourceMigration('ProductsNew');
    $this->addFieldMapping('title', 'title');
    $this->addFieldMapping('commerce_stock')
      ->defaultValue(5);
    $this->addFieldMapping('field_blinds_colour_specific', 'colour_specific');
    $this->addFieldMapping('field_blinds_composition', 'composition');
    $this->addFieldMapping('field_blinds_width', 'width');
    $this->addFieldMapping('commerce_price', 'price');
    $this->addFieldMapping('field_blinds_price_group', 'price_group');
    $this->addFieldMapping('type')
      ->defaultValue('blinds');
  }

  public function prepareRow($current_row) {
    $colours = explode(';', $current_row->colour_specific);
    // // print '<pre>';
    // // print_r($colours);
    // // print '</pre>';
    $current_row->colour_specific = $colours;
    // $current_row->migrate_map_destid1 = 62;
    // $current_row->migrate_map_destid2 = 67;
    print_r($current_row);
    return TRUE;
  }

  public function prepare($entity, stdClass $row) {
  }
}


texts: Rules: how to create variable with PHP and $_SERVER['HTTP_REFERRER']

texts:
I want to parse the query string off the HTTP_REFERRER and make that available as a variable for actions to use.

I feel like one of these options should let me do that, but I can't be sure...

The concept is simple

<?php
  $parts = parse_url( $_SERVER['HTTP_REFERRER'] );
  parse_str( $parts['query'], $q );
  // now set $q (or its elements) as the variable
?>


texts: Drupal form won't save with TinyMCE (Firefox only)

texts:
I have a Drupal form with a TinyMCE (3.5.6) instance on it, this is instantiated via the Wysiwyg module. If I save the form in Firefox, it visually displays an AJAX spinner but nothing happens, the form does not save and leaves me on the form. All other browsers work. I can get it to work 2 different ways but not sure why it works and how to translate that to a permanent fix. I have been going through all the suggestions in http://www.tinymce.com/forum/viewtopic.php?id=18821 but have not been successful yet.

1.) If I unminify the code with http://jsbeautifier.org it works without throwing console errors but JSLint throws tons of lint errors in the code.

2.) If I delete the code below it works,

<textarea rows="3" cols="60" name="field_caption[und][0][value]" id="edit-field-caption-und-0-value" class="text-full form-textarea" style="display: none;" aria-hidden="true"></textarea>it works but with the below error:

but throws this error.

NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMHTMLDocument.implementation]
http://loc.dbtv.nbcuni.com/sites/all/libraries/tinymce/jscripts/tiny_mce/tiny_mce.js?mhcuev
Line 1

Here is a video of the issue at hand => https://docs.google.com/file/d/0B47tip0c_KEtY2w1akUtcFZHYUU/edit


texts:
I feel like I'm missing something, because I can't find a module that does this, but it seems like it should be really common.

I would like users to be able to simply enter their email address to subscribe to my site so that I can send them an email whenever I post a new Article. I don't want to require them to create a full drupal account, just a simple email address and then click a verify link.

I've tried Simple Subscription and it provided a simple form block which provides essentially what I'm looking for on the front end:

However, when a user enters their email address this module doesn't provide a verification email. So, I need something more complicated that Simple Subscription.

Any suggestions?


texts: How to get the node id before saving the node in drupal 6?

texts: I have created a content type called 'inquiry.'  I am using the rules module to send an email after submitting an inquiry.  My requirement is to get the node id before it is saved.  I need to generate a link from that node id so the inquiry handler can view the inquiry by clicking on that link.


texts: How To Override Webform's Submission Template in Drupal 8

texts:
The template provided by the Webform module for theming a submission is rather plain. Basically, it looks like a print_r of the data variable. If you try to add HTML to validation function before it gets submitted, the HTML just gets rendered as plain text.

So I was trying to find a way to override the template from a module as opposed to a theme. I'm not able to find much documentation for this right now.

How do I override webform's default submission HTML template from a module?


texts:
I am using fuzzysearch module on Drupal 6, and his integration with Google Analytics. Regular google analytics query is working if I put query such search/node.
I've tried query like fuzzysearch/results but that one gives 0 results in google analytics?
Do i have to enable something else in my Drupal 6 admin/settings/fuzzysearch/ or fuzzysearch is not compatible with google analytics?
I am using webmaster tools for Google analytics integration, where I place query.

Thanks,
Michael.


texts: "?n" appended to URLs... why? How do I prevent this?

texts:
When CKEditor references my theme's stylesheet (as well as other resources), it appends ?n to the path. Here's a screenshot from Chrome's web inspector (see highlights):

(This is from the <iframe> that loads in CKEditor's editing box)

As far as I can tell, that ?n is preventing CKEditor from loading the most current version of the stylesheet. When I remove ?n (in the web inspector), the latest version loads.

So what is ?n and how do I force it to use the most current version? I've tried flushing caches, but to no avail. It must be some kind of versioning thing?


texts:
I'm trying to create an AJAX controller to rebuild an existing form. It's in the Poll module.

the module has a builtin AJAX replace controller triggered after at the vote POST.

  /**
   * Ajax callback to replace the poll form.
   */
  public function ajaxReplaceForm(array $form, FormStateInterface $form_state) {
    // Embed status message into the form.
    $form = ['messages' => ['#type' => 'status_messages']] + $form;
    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    $renderer = \Drupal::service('renderer');
    // Render the form.
    $output = $renderer->renderRoot($form);

    $response = new AjaxResponse();
    $response->setAttachments($form['#attached']);

    // Replace the form completely and return it.
    return $response->addCommand(new ReplaceCommand('.poll-view-form-' . $this->poll->id(), $output));
  }

What I want to do is a similar controller I trigger to (re)build the form on page load (I'm dealing with varnish/poll trouble) and replace the container.

I have no idea how to do it right.


texts: How to get the translated term name by tid?

texts:
I'm looking for a working method to get the translated term name by tid.

The following code returns the original term name but not the translation.

global $language;

$lang_name = $language->language; // en

$term_id = 788;

$term = i18n_taxonomy_term_get_translation($term_id, $lang_name);

Most examples provided in "how to get the translated taxonomy term programmatically?" seem not work for Drupal 7.


texts: How can I set up Drupal so people can collaborate on content development prior to making it public

texts:
I have a small website which, from a modules perspective, I want to keep as simple as possible.

Apart from displaying content, a main purpose of the site is to facilitate collaborative authoring and publishing of: articles, product updates and case studies.

To achieve this I would like individual contributors to be able to create & edit content prior to public release (just to be clear, I'm not looking for concurrent editing here).

This seemingly simple requirement leaves me stumped because unpublished content seems unavailable for further editing by the original creator, let alone co-collaborators.

Similarly, some items of content will need periodic updating. To achieve this I expect they will need to be reviewed, updated & debated offline, but in a way that leaves the current version public.  The update process needs to allow multiple authors to edit in private prior to republishing / making the updated content public.

I'm at a loss as to how this is most easily achieved - would appreciate any advise that leads to a simple solution.


texts: Why cant I configure or remove this module?

texts:
I was trying to figure out Google Analytics and installing it broke my site so I uninstalled it.  Now I have reinstalled it, There is no link to configure it and the configuration page isn't even accessible from the URL.

So I tried to uninstall the module again and when I try to uninstall it goes to white screen and when I refresh I get back to the modules list and the module is still there.  I cannot configure or uninstall or get the module to work. It seems to be stuck there.

I have even tried to WinSCP into the server and straight up delete the module.  This removes the file from the list but when I reinstall the module I am back to square 1 where I cannot do anything with it.

I checked the error log and when I try to uninstall I get the following error PHP Fatal error: "Call to undefined function google_analytics_clear_js_cache()"

Is there anything I can do?


texts: Views row style plugin override not saving in Views UI

texts:
In my ongoing journey to create a customized RSS feed in my D8 site, I've finally gotten closest to what I need by using a Feed display in Views. The basic feed is working, but I need to add a couple custom elements for each item. So based on the fact that the rss fields are rendered in the RSSFields class (\Drupal\views\Plugin\views\row)

namespace Drupal\video_export\Plugin\views\row;

use Drupal\views\Plugin\views\row;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Renders an RSS item based on fields.
 *
 * @ViewsRow(
 *   id = "mycustom_rss_fields",
 *   title = @Translation("My Custom Fields"),
 *   help = @Translation("Display fields as RSS items."),
 *   theme = "views_view_row_rss",
 *   display_types = {"feed"}
 * )
 */
class MyCustomRssFields extends RssFields {

  public function render($row) {
    parent::render();

  }
}

So when I place this in /modules/custom/video_export/src/Plugin/views/row, if I go to select the style, I see my new plugin, but when I click Apply, nothing happens. Is there anything else I need to add to my override to get it to save?


texts: Altering UserPasswordForm redirect with a custom submit

texts:
I want to alter the redirect of UserPasswordForm from Drupal’s core, I did this

function maubl_user_form_alter(&$form, FormStateInterface $form_state, $form_id){
switch($form_id) {
case 'user_pass':
    $form['actions']['submit']['#submit'][] = 'maubl_user_submit_forgot_pass';
    break;
}
function maubl_user_submit_forgot_pass(&$form, \Drupal\Core\Form\FormStateInterface $formState){

  $formState->setRedirect('<front>');

}

It does do the redirect correctly, but the submit  from UserPasswordForm doesnt excute anymore, so the mail doesnt get sent, does anyone know why and how I can fix that ?


texts: reCAPTCHA module not working for subdomains in Drupal 6

texts:
I am using Google reCAPTCHA https://www.google.com/recaptcha/intro/index.html for pointing to domains and subdomains, with reCAPTCHA drupal module.

Now, personally i dont really think that it matters is it a "www.example.com" or "www.example.dev.com" if i put both of the domains inside google's recaptcha domain list.

Problem I'm facing is that on "www.example.dev.com" I see enabled recaptcha module, so i can click I'm not a robot and sometimes I do get message like pick fruit or a car, which is fine, but after I click login i just get page refreshed.

I have been trying things from this post as well : https://www.drupal.org/node/311538 and In settings.php, I found this section $cookie_domain = 'www.example.dev.com'; but it didn't work.

Did anyone face this before, because its really annoying for DEV sites not to have it enabled, and if i want to do some testing on them i have to go and do drush dis recaptcha and then clone to PROD version after.

It's only on Drupal 6, Drupal 7 is fine.


texts: Recommend nodes based on current node field value in view block

texts:
I have made a view block to show on each node for recommending other node of similar interest type.

Every node have a field called Main Category, which is taxonomy.

I want to show those node title which has similar category where view block is attached(I mean at node page).

Note - I have attached view block into node by EVA field.


texts: Views: sort criteria -> Post date, not start from latest but latest-3

texts:
is there a possibility to sort articles by postdate, but exclude the latest 3 and start with number 4 (because the latest 3 are already displayed in another view).

Or even better: is there in general a possibility to exclude articles already displayed on the same page but in another view?


texts: Add bootstrap button to rewrite output views

texts:
I have a view with a table, the last column is a link but should be a button.
So in the last field i enable rewrite output and add this code

<button type="button" class="btn btn-default">
      [clone_node]
</button>

I am using the bootstrap theme. But views is filtering out the button code.
What is the fasted way to change the link into a button?


texts: Drupal 8: Add custom class according to taxonomy in Views

texts:
I have content type car, which has three fields: car model, year model and category (taxonomy term). In taxonomy term, I have three lists: volvo, toyota and BMW.

In the picture below, I have added a custom class called grid-item and besides that I would like to add a category name such as volvo, toyota or BMW. I would able to add category name if replacement patterns has been available :/

In the source code, you guys can see that I have class grid-item and I want to have a category name accoding to cars next to it.


texts: Use Checkboxes with Drupal Better Exposed filter

texts:
Better Exposed Filters is not showing the option for Radio buttons and Check boxes. How do I enable it?

Better Exposed Filter working well and good until I enable the Auto Submit option. My Check boxes are gone and shows simply the list. So I uncheck the auto submit, but still i don't get the options to choose.

The filter criteria are set to "Content: Has taxonomy term"; the selection type is "Dropdown."


texts: Adding variable to user profile page in drupal 6

texts: I have a custom module let say mymodule. One of the function in this module generates or returns  some contents. Forget about what the content is. My question is how could i add this content to user profile page. I tried to override using user-profile.tpl.php file. I could override the theme. But how to add a variable to this page that contains the required content so that i can echo the variable. Is there any preprocessing function that will help


texts: How use views exposed filters with taxonomy and panels

texts:
I need some help with the use of contextual and exposed filters with taxonomy terms views using panels.

Context:

I have a panels taxonomy page overriding drupal default page.
In this page I have a views content pane display listing nodes with contextual filter set to "has taxonomy term Id" with type "taxonomy term id from URL" and "limit terms by vocabulary".
In "filter criteria" section I have a content type filter and the most relevant for my case, an exposed filter: "Content has taxonomy term", "is one of... allow multiple selection..." the usual.
4- In Pane settings: Use panel path, set to "Yes".

The idea behind this is to have a taxonomy views pane showing results with exposed filters in the panel page. I.E: The user go to "animales/aves" URL and see as expected all the nodes from a content type categorized as "aves". The problem here is when the user try to filter to another animal category. In my example, the view give me no results. The URL change from animales/aves to this: animales/aves?tid[]=1 (or other id) but allways I get an empty view, except if I select back the exposed filter for "aves".

Any help?

Drupal 7.41
Ctools 7-1.9, Panels 7-3.5, Views 7-3.13


texts: Can the path of Search module (/search) be changed without altering the module, to allow use of this path by a custom module?

texts:
I am dealing with a custom search that, for years, has been accessible via /search.  New site requirements call for the Search core module.  However, that module has hardcoded /search in hook_menu().

I can not find a way to change the path for the core module without changing that module, which I do not want to do.

Notes:

I have seen hook_url_inbound_alter but I don't think this will work, as I still need /search to work.
I have disabled the menu item, but that just results in a "Not Authorized" page to non-admin users.


texts: How do I style a block title for a single menu in a fusion theme?

texts:
I have a custom menu placed in the sidebar1 region of a fusion-based sub theme. The menu is displayed with the Menu name as the block title.  When displayed, the title is styled with
.  If I set colors and backgrounds in css style sheet as h2.title.block-title {}, all block titles on the page for all regions are styled the same way, but I would like to limit the style to just one specific menu. When rendered, the menu block is embedded within a couple
 levels including one for the region
. Using h2.title.block-title.sidebar-first-inner {} does not work. How do I limit the style to just this one location of h2?


texts: Normally, a webform places the body content first and then the form after. I want to reverse it. I want the form to appear first and the body content to appear afterward. Is this possible?


texts: Are 'active' and 'staging' required in config_directories?

texts: Is it OK to delete the 'active' and 'staging' entries automatically created in settings.php? I don't plan on using them, but it's not clear to me whether some process might expect them to exist.


texts:
I am using Drupal 7. The website I am on was configured previously. My goal is to add an external link to a page. However, i am having trouble. Every link I add to any page is read as a relative link. For example, if I have the following code:

Google

The URL in the browser becomes: dev.mysite.com/#http://www.google.com
But, I want the URL to be http://www.google.com

First, Can i fix this using PHP?
Second, Is this something the Pathauto Module is responsible for, or maybe the Rewrite module? Both are enabled on the site
Lastly, is it a mod rewrite issue? If so, how would i fix it?


texts:
I'm trying to write a custom RulesAction to perform an operation after an order status is updated. Basically, I want to perform this operation after checkout is complete (but this event doesn't exist anymore in D8).

namespace Drupal\my_module\Plugin\RulesAction;

use Drupal\uc_order\OrderInterface;
use Drupal\uc_order\OrderStatusInterface;
use Drupal\rules\Core\RulesActionBase;

/**
 * Definition of the action performed.
 *
 * @RulesAction(
 *   id = "my_action_id",
 *   label = @Translation("My action label"),
 *   category = @Translation("My module"),
 *   context = {
 *     "entity" = @ContextDefinition("entity",
 *       label = @Translation("Entity"),
 *       description = @Translation("Specifies the entity, which should be saved permanently.")
 *     )
 *   }
 * )
 */
class MyActionClass extends RulesActionBase {

  /**
   * Def.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *    The order update triggered by rules.
   */
  protected function doExecute(OrderInterface $order) {
    // @TODO.

  }

}

My action do come in rules, I have set it up after the event: After updating order (rules_entity_update:uc_order)

When triggering it I get the error :
If I set the context to entity (I've looked and no context is defined by ubercart for order):

  The website encountered an unexpected error. Please try again
  later.Drupal\Core\Entity\EntityStorageException:
  Required context entity is missing for plugin my_action_id. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
  (line 783 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

If no context is set :

  The website encountered an unexpected error. Please try again later.
  TypeError: Argument 1 passed to
  Drupal\my_module\Plugin\RulesAction\MyActionClass::doExecute()
  must implement interface Drupal\uc_order\OrderInterface, none given in
  Drupal\my_module\Plugin\RulesAction\MyActionClass->doExecute()

So my questions are :

Do I need a context for rules action to work ?
If yes, how can I find it and get it working ?

Here are the documentations I find (but rules is unfornately not very well documented for now):

Rules documentation for dev |
RulesAction examples |
Context documentation


texts: Syntax to display only the node body using node embed module

texts:
Would appreciate it if someone could let me know what the syntax is to display only the node body within another node.  I tried something like this:

[[nid:1234 body]]

Obviously, that is not working.  Any ideas???


texts:
I have created an help page for my module

function amu_hal_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.amu_hal':
       return 'some content';
  }
}

This does create a page at

  /fr/admin/help/amu_hal

How can add the correspondong link on main help page

  /fr/admin/help


texts:
Just for learning, this document explains me in a "ballpark" way how cache rebuild works, but I want to know more about "Updates the system with latest information about extensions (modules and themes)."

What happens with modules and themes when I rebuild the cache?


texts:
I created a form which takes user input for fields: title, link, date and description, however I have another field which is guid and it cannot be user created. This field needs to be created with hook_form_alter() which takes the user inputted link and concatenates a string to the front and then return it to the submit handler for db_insert. How can I go onto doing this? here is my submit handler

function rss_list_creator_form_submit($form, &$form_alter) {
//$GUID = returns GUID from hook_form_alter()
$query = db_merge('rss_table')
->key( array('GUID' => $GUID))
->fields( array(
'title' => $form_state['values']['title'],
'link' => $form_state['values']['url'],
//'GUID' => $GUID,
'date' => $form_state['values']['date'],
'description' => $form_state['values']['description'],
))
->execute();
}

**I solved my problem, since I have two forms available I needed to enclose the code in a switch statement. Here is the code block:

function rss_list_form_alter(&$form, &$form_state, $form_id) {
 switch ($form_id) {
  case 'rss_list_creator_form':
  if(isset($form_state['values']['url'])){
    $guid = 'tag:news.google.com,2005:cluster=' . $form_state['values']['url'];
  }
  $form['guid'] = array(
    '#type' => 'hidden',
    '#default_value' => !empty($guid) ? $guid : '',
  );
  break;
 }
}


texts:
A Drupal 6 membership-based site has some rules in place to block registrants based on certain field values (that spammers are using).

When this happens, it triggers the system to send an email to the site admin, as though "Visitors can create accounts but administrator approval is required" is checked, although it's not. While this is a bug, it's not the problem here.

The problem is with the URLs in the email. Sometimes, the link is written correctly, as in:

  florenefl has applied for an account.
  http://www.sitename.com/user/8872/edit

and sometimes the http:// is followed by only 2 "ww"s:

  fdstyd52as  has applied for an account.
  http://ww.sitename.com/user/8880/edit

This second link doesn't work for the site admin. It appears to occur randomly. Any ideas why this would happen?

EDIT: the email is sent from user.module line 1720

  case 'register_pending_approval_admin_body': return t("!username has
  applied for an account.\n\n!edit_uri", $variables, $langcode);

Using the Maillog module, I checked the Welcome emails sent to regular users which also uses !edit_uri. I don't see any with the truncated "www".

I also modified the rule to email me when a registrant is blocked, and to include the token for user/*/edit. That URL is also faulty in the emails ... corresponding to when the system emails are faulty. So whenever an account gets blocked, and the email is triggered (whether through the system or through Rules), it appears to randomly truncate the www.


texts:
I have installed the drupal Print module, but have not been successful in getting wkhtmltopdf to work. The drupal print documentation is outdated and despite of a number of request to update it, it still is outdated. https://www.drupal.org/node/306882

CASE DESCRIPTION
In my case, I want to allow the creation of pdf versions of nodes. The Nodes have inline CSS (using Tinymce editor with Wysiwyg). I tried using Dompdf library, but the inline css is not being used for the created pdf.

I have read that wkhtmltopdf creates an internal browser that renders a html page, so that should be the ideal solution in this case.

However, after downloading the rpm file from http://wkhtmltopdf.org/ into the sites/all/libraries folder of my website, and installing it using
   rpm -Uvh wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm
in my website, the library is not recognized, not visible in the status report page and not in the pdf configuration page /admin/config/user-interface/print/pdf


texts:
I have a url like this: http://localhost/something/de/

The last one is the language code de for German. I want to fetch it using javascript. The link may also become like this: http://localhost/something/de/node/artist/117/author/98, in that case how do I fetch the language part.

Actually I want to set up placeholder using javascript, I got the help for placeholder but I dont get how to fetch the language part from url.


texts:
I need a column (field) in a view where you can see the date of a specific state (Workflow state).

For example:
A content type news has three workflow states: new, reviewed, published.
Now I need a view where you can see each news (also ones that haven't entered that state!) with a field where the date is shown when it was new, reviewed and published (sortable).
The Workflow module only provides "Previous time", but that's not specific to a state.

Any ideas?

I know how to program a views handler for custom table/fields but my problem is that the node -> workflow_node_history has an 1:n relation.

drupal 6, workflow 1.5, views 2.x

Example:

Title   | Date new     | Date Reviewed | published
---------------------------------------------------
Title1  | 01.03.2012   | 13.03.2012    | pending
Title2  | 02.05.2012   | 16.05.2012    | 20.05.2012
Title3  | 20.05.2012   | pending       | pending


texts: Writing PHP code to creating menu in block show and alert

texts:
I have a menu in a block and this is my code in that block that is in sidebar second:

<?php
  $url=$base_url.'/drupal';
  echo
  '

One

 Two

';
?>

it is working correctly, but return and red alert:

  Notice: Undefined variable: base_url in eval() (line 2 of C:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).


texts:
views_preprocess_node() contains the following code.

  if (!empty($vars['node']->view) && !empty($vars['node']->view->name)) {
    $vars['view'] = $vars['node']->view;
    $vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->name;
    if (!empty($vars['node']->view->current_display)) {
      $vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->name . '__' . $vars['node']->view->current_display;

      // If a node is being rendered in a view, and the view does not have a path,
      // prevent drupal from accidentally setting the $page variable:
      if ($vars['page'] && $vars['view_mode'] == 'full' && !$vars['view']->display_handler->has_path()) {
        $vars['page'] = FALSE;
      }
    }
  }

The part to which I am interested is the line that initializes a variable using the value of $vars['node']->view. I looked at the code executed from the Views module for a node, but I was able to find where $node->view is initialized.

Which of the node hooks (e.g. hook_node_view(), hook_node_load(), hook_node_presave()) would get a valid value for $node->view?


texts:
So I have a website structure as follows:
Homepage > Level 1 > Level 2 > Level 3 (Article)

On display of a Level 1 page I want it to print out all of the level 2 articles that are a child of that content (relationships taken from the main menu). Information that needs to be printed is title, body summary, plus a custom image field that I have added.

This image shows the desired effect: the user is in About Us (Level 1), and so the main body of the site displays teasers of the level 2 pages (Who we are, what we do etc.) that have been set as children to About Us in the main menu.

Is it possible to take the parent/child relationships from the main menu, then on a page print the content of the child pages in this way?

Or, if not using the menu, is there a more appropriate/logical way to do this in Drupal?

I have lots of experience in using MySQL/PHP and writing custom modules in other content management systems however new to Drupal. Thank you for your help!


texts: How to redirect to another page using the url alias?

texts:
Here is my code where I am trying to redirect to a page using its url alias:

    $url= Url::fromUserInput('/thank_you_for_your_message')->toString();
    $form_state->setRedirect($url);
    return;

and I get this error : Symfony\Component\Routing\Exception\RouteNotFoundException: Route "/thank_you_for_your_message" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName()

Is the fromUserInput the correct way to redirect to an internal url alias?


texts: What are the implications of duplicate content issues with Drupal comments?

texts:
Say we have a node called node/123 with comments enabled. When comments are made, additional URLs are generated /comment/1, /comment/2 ... and /comment/reply/2/1 etc. Unfortunately, these new URLs are a page that contains a full copy of the content in the original page /node/123 or the comment in reply. Core's robots.txt only has Disallow: /comment/reply/

Would there be any implications to adding the following to the robots.txt file? Would this be recommended (or even post a core issue pointing this problem out?)

# Paths (clean URLs)
Disallow: /comment/
Disallow: /comment*/
Disallow: /comment/reply/
Disallow: /comment/reply*/
...
# Paths (no clean URLs)
Disallow: /?q=comment/
Disallow: /?q=comment*/
Disallow: /?q=comment/reply/
Disallow: /?q=comment/reply*/


texts:
I've logged out my drupal 7.22 website and have no login/admin block. It's hosted locally.

I've tried the following URL queries, with no desirable results. The page remains the same and I cannot locate any block I can use to log in-

localhost/drupal/user/logout (Prints Access Denied on Title bar)
localhost/drupal/user/login (Prints User Account on Title bar)
localhost/drupal/?q=user (Prints User Account on Title bar)
localhost/drupal/?q=user/login (Prints User Account on Title bar)

Any help?


texts: Display Field Collection items as select list in other content type

texts:
I have 2 content types, lets say A and B. There is field collection item in content type A (in which unlimited values could be added). User adds data in this field as he creates new content.
I want all those field collection options filled by user in A to appear as a select list while submitting content type B.
I create an entity reference field in content type B and tried to display all options of field collection item from A. It shows perfectly as I tested it in view.
Issue:

If I select to display all values in a single row, it shows all options in one row of select list.
I actually want to display each option in separate row, but it shows only the last item.

Anyone knows the solution?
Here are Settings of my View:

And this is my Field Setting:

As you can see, in View it shows both option. But in select list it shows only last option or all options in single row (by changing setting).


texts: How to execute custom code on user signup

texts:
I need to do a REST request every time a new user signs up.

The REST request returns some data that I need to store for the Drupal user account, and be able to present as content somewhere.

What is the best/cleanest way to do that?


texts:
I want to have a content type named person with fields like first name, last name, phone number ....

In another content type named account, it will also contain the fields belong to person, but I want to have a drop down list for the field person in account to select from existing person content, and auto populate the rest of the fields in account.

Also, is it possible to auto populate a field based on the value in previous field? For example, two fields of the same content type, user id and user email, while user input the user id sunnyside, user email would automatically generate sunnyside@gmail.com.

Thanks


texts:
I'm using the Node Export Features module to move over some blogs to another Drupal installation.

Everything seems to transfer but the created date. It resets all nodes to the present date.  How do I preserve the original created date?


texts: How to add multiple conditions on a single field in views?

texts:
I have two fields in my content type. State and test . State have two values active and inactive and test is a boolean field.

I want to display the content of this content type using views which will display:

active content
inactive content if test is FALSE

How can I do this in views?

I tried with views filter groups and it generates this condition.

WHERE ((( (node.status = '1') AND (node.type IN  ('mycontnt')) AND (state = 'active') )OR( (state = '4') AND (test = '0') )))

But this is not displaying the correct content as I want.


texts: Storing data / session for anonymous user

texts:
I am working on a shop, and for the cart, i need to store items before payment.

  $tempstore = \Drupal::service('user.private_tempstore')->get('boutique');
  $tempstore->set('poids', $form_state->getValue('poids'));

I take a look on the user service for :

  pivate_tempstore and shared_tempstore

But that work only for authenticates users.

What can I use for store data ? $_SESSION ? or Drupal 8 has a service for that ?


texts:
I get this error a lot in the drupal logs. Several times an hour.  Anyone know why, what the impact is, and how to fix it?

My config:

Acquia Drupal 7.36
Running in IIS 7.5 / Windows Server 2008
Solr 4.6
PHP 5.3

Error:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'env_id' in 'field list': INSERT INTO {apachesolr_stats}
  (timestamp, uid, sid, numfound, showed_suggestions, total_time,
  prepare_time, process_time, page, keywords, filters, sort, env_id,
  page_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5,
  :db_insert_placeholder_6, :db_insert_placeholder_7,
  :db_insert_placeholder_8, :db_insert_placeholder_9,
  :db_insert_placeholder_10, :db_insert_placeholder_11,
  :db_insert_placeholder_12, :db_insert_placeholder_13); Array (
  [:db_insert_placeholder_0] => 1423845337 [:db_insert_placeholder_1] =>
  697523 [:db_insert_placeholder_2] =>
  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [:db_insert_placeholder_3]
  => 35 [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 15 [:db_insert_placeholder_6] => 15 [:db_insert_placeholder_7] => 0
  [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => question
  about bill [:db_insert_placeholder_10] => a:0:{}
  [:db_insert_placeholder_11] =>
  a:2:{s:5:"#name";s:5:"score";s:10:"#direction";s:4:"desc";}
  [:db_insert_placeholder_12] => solr [:db_insert_placeholder_13] =>
  core_search ) in apachesolr_stats_exit() (line 191 of
  D:\Inetpub\wwwroot\sites\all\modules\apachesolr_stats\apachesolr_stats.module).

UPDATE:

I am running apachesolr_stats v. 7.x-1.0-beta1

Running update.php produces this error:

  Warning: Invalid argument supplied for foreach() in apachesolr_stats_block_info() (line 961 of D:\inetpub\wwwroot\sites\all\modules\apachesolr_stats\apachesolr_stats.module)


texts: ERROR 403 - FORBIDDEN on including FULL url as query string parameter

texts:
after moving to new server, i started to get 403 on the following link...any help?

http://www.mywebsite.com/redirect/89431/?url=http://www.externalWebSite.com/blog/2014/10/05/

the goal is to redirect the user to the external website.

below is the module (even i dont think the problem is from it)

<?php

function redirect_menu() {
    $items = array();
    $items['redirect/%'] = array(
        'title' => 'Go To URL',
        'page callback' => 'page_redirect',
        'page arguments' => array(1,2),
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
     );
    return $items;
}
function page_redirect($arg1) {
    $nid = $arg1;
    if (is_numeric($nid)) {
        if(node_load($nid)){
        db_merge('node_counter')
          ->key(array('nid' => $nid))
          ->fields(array(
            'daycount' => 1,
            'totalcount' => 1,
            'timestamp' => REQUEST_TIME,
          ))
          ->expression('daycount', 'daycount + 1')
          ->expression('totalcount', 'totalcount + 1')
          ->execute();
        }
    }
    if (isset($_GET['url'])){
        drupal_goto($url);
    }
}

?>

NOTE:
THE FOLLOWING DO NOT GIVE 403 ERROR (NOTE AFTER THE http in the query string):

http://www.mywebsite.com/redirect/89431/?url=http//www.externalWebSite.com/blog/2014/10/05/

http://www.mywebsite.com/redirect/89431/?url=http:/www.externalWebSite.com/blog/2014/10/05/


texts: Commerce price attributes doesn't work when I use commerce discount for products

texts:
I used commerce pricing attributes in order to add extra fee based on a select box field. For example if user select black from color attributes, price increases 10$ and if user select white, price increases 5$ today, I have installed commerce discount module and defined a discount for all products.

But it seems price attributes doesn't work when discount is defined for product. Because by changing color in no change happened for price.

what is your suggestion to solve this problem?


texts:
Currently, there is a security issue of Drupal CMS, I'm using Drupal version 8.3.4, does the version 8.3.9 can solve the security issue released on March 28th, 2018 PSA-2018-001 (core highly critical release)?

I tried to update to version 8.5.5, but some of the modules did not work after an update. I got the error message "the website encountered an unexpected error. please try again later".


texts: How to set newest first in the view of content created

texts: How to set newest first in view of content created. So far I have created a view for content type and now it's displaying created new content on last page but I want to set in first page. Can anyone help?


texts: How can I conditionally display something in Views header area depending on the argument in URL?

texts:
The URL of my page view looks like my-view/%1/%2
The first argument %1 is term id of either vocabulary A or B or C and all of them are hierarchical taxonomy.

How can I conditionally display something in Views header global text area depending on which vocabulary %1 is or if it's parent term or child term?


texts:
I would like to create a block and place that on the right hand side of my site.

Within the block I would like to have a list of links.

The links would scroll the viewport down to that article.

The page will be the homepage of the site.

I will use Views to create a page. I will select 10 full articles to be displayed on the page.

How can I go about creating a block to add to the right hand side which will contain links.

I will need to have an id hook on the h1 of the article titles for
the links to work.
I have to loop through articles which show up in the view to get titles
I need to create a block using the titles to create links such as a href="#example-article"

Day to day I code in Ruby on Rails, I am working on a Drupal project for a client and I am not well versed in PHP, never mind Drupal. I wouldn't be surprised if someone had wanted this same feature in the past - however - I don't work with 'blog style' sites often and I have not found any examples when searching online.

Any tips would be much appreciated. A link to a guide on how to achieve this would be amazing. Merely explaining how to get the articles object and loop through it for the titles and then put this in a block would get me 90% there.


texts: Webform: states dropdown vs textbox plain text in case of other country autoswitch?

texts:
How can I make a webform so when a user selects the country US it will show the states in a list with a mandatory select from list
and when other countries it will show Province as textedit also mandatory..
i don't want to mess arround with Jquery and hide the controls resulting into multiple fields


texts:
I am using the RESTful Web Services that is included in core of Drupal 8.2.7.
I need to activate CORS to be able to call the API from another domain.

I put this configuration in this file: "core/lib/Drupal/Core/core.services.yml" but it didn't work. I don't have the header Access-Control-Allow-Origin.

cors.config:
  enabled: true
  allowedHeaders: ['*']
  allowedMethods: ['*']
  allowedOrigins: ['*']
  exposedHeaders: true
  maxAge: true
  supportsCredentials: true

I found also this configuration is present in "sites/default/default.services.yml".

What is the proper way to configure CORS ?


texts: How to set a form field sizes based upon the screen size responsively?

texts: I'm building a mobile-first module in D7. I want to set the size attribute of a form (textfield, textarea) depending upon the screen size (i.e., using css media query). Is this possible?


texts:
I have the autosave plugin for CKEditor enabled and working, but I want to change from some of the default settings (specifically save detection selectors and autosave_delay) and can't get the settings to "stick".  I have been editing ckeditor.config.js (in modules/patched/ckeditor/) and, while that's executing, the settings changes aren't making it to the editor instance running on the page.  I've also hacked at ckeditor.utils.js because I was able to get closer to the actual instance but I know that isn't best practice and I'll regret it down the road.

Drupal7 fyi


texts: Unable to get through to the custom form using hook_menu page callback?

texts:
Inside the hook_menu I have ,

$items['abc/def/%node'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array('heart_form',2),
    'access arguments' => array('modify  heart status'),
    'type' => MENU_CALLBACK,
  );

Inside my custom form I have the foll code..

function heart_form(&$form_state, $node) {
   $form['notes'] = array(

    '#type' => 'textarea',
    '#required' => TRUE,
    '#description' => t('Please give an explanation'),
  );
  $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));

  return $form;
}

But when I try to go on the link , www.example.com/abc/def/18 I get a page not found message
What is the error ?


texts: Commerce Shipping - arbitrary calculations

texts:
I'm using Drupal Commerce to create a simple shop and I wish to add shipping cost calculations based on the weight (in grams) of items in the cart. I have set a weight field on each product so I can work out what the total is, but the client has specified arbitrary prices depending on weight and destination:

UK
weight = 0 price = 0.00
weight < 250 price = 1.00
weight < 500 price = 1.50
weight < 750 price = 2.00
weight < 1000 price = 3.00
weight < 2000 price = 5.00

Europe
weight = 0 price = 0.00
weight < 250 price = 2.50
weight < 500 price = 4.00
weight < 750 price = 5.00
weight < 1000 price = 6.25
weight < 1250 price = 7.50
weight < 1500 price = 8.75
weight < 1750 price = 10.00
weight < 2000 price = 11.25

Other
weight = 0 price = 0.00
weight < 250 price = 4.00
weight < 500 price = 6.50
weight < 750 price = 8.75
weight < 1000 price = 11.25
weight < 1250 price = 13.75
weight < 1500 price = 16.25
weight < 1750 price = 18.75
weight < 2000 price = 21.25

Would I need to add a shipping calculation rule for each possible scenario or is there a way to configure rules to look up a table?


texts: File field and using a specific display format with file_view_file

texts:
I am using a HOOK, hook_preprocess_node, to create some additional output variables for templates.  One field is a type of FILE which is using the Media module to link a image file to the object.  Using MANAGE DISPLAY, I can set the output to "Rendered File", but when I do this in code, the output looks to be in its default format.

Below is a sample of the code.

  function hmtest_preprocess_node(&$variables) {
    if ($variables['type'] == 'presentation') {
       $node = $variables['node'];
       $Afield = field_view_field('node', $node,
          'field_presentation_backgrounds');
       $variables['backgrounds'] = render($Afield);
    }
  }

I know that field_view_field takes a fourth parameter $display, but I'm not quite sure what this would look like.

How do I specify the correct format filter for this field in code when it is setup through the Drupal admin UI?


texts:
I did a Drupal site with a field gallery using nodes as albums containing multiple images.. i am using MultiUpload module to upload whole folders at one time instead of 1 image at the time like the standard image module provides. Most pictures are 1024x768 , but the photographer has also some vertical pictures 768x1024 , and when they are uploaded Drupal automatically takes the tall 768x1024 and rotates them to 1024x768 .. i just want them to be shown tall if they are tall ..

Thank you


texts: Cannot print page title in page.html.twig

texts:
The following line in page.html.twig does not print the page title:

<h1>{{ title }}</h1>

The page title outputs using the Page title block, but not this piece of template code. I found the title variable in the documentation commented out at the top of page.html.twig. Does this code need to be wrapped in something else?


texts: Allow html tags in Form submit button in block plugin

texts:
I'm using a block plugin to render a user specified form. I'm retrieving the form like so:

public function blockSubmit($form, FormStateInterface $form_state) {

    $this->configuration['template'] = $form_state->getValue('template');
    $selected_entity_type_bundle     = $form_state->getValue('entity_type');
    $values                          = explode('.', $selected_entity_type_bundle);

    $this->configuration['entity_type']             = $values[0];
    $this->configuration['bundle']                  = $values[1];
    $this->configuration['entity_type_submit_text'] = $form_state->getValue('entity_type_submit_text');

}

private function buildEntityForm() {
    $values = array();
    // Specify selected bundle if the entity has bundles.
    if (\Drupal::entityManager()->getDefinition($this->configuration['entity_type'])->hasKey('bundle')) {
        $bundle_key = \Drupal::entityManager()->getDefinition($this->configuration['entity_type'])->getKey('bundle');
        $values     = array($bundle_key => $this->configuration['bundle']);
    }
    $entity = \Drupal::entityManager()
        ->getStorage($this->configuration['entity_type'])
        ->create($values);

    if ($entity instanceof EntityOwnerInterface) {
        $entity->setOwnerId(\Drupal::currentUser()->id());
    }

    $form = \Drupal::entityManager()
        ->getFormObject($this->configuration['entity_type'], 'default')
        ->setEntity($entity);

    return \Drupal::formBuilder()->getForm($form);
}

This grabs the form just fine, and I render it using

public function build() {

    if ($this->configuration['entity_type'] != '') {
        $entityForm                                = $this->buildEntityForm();
        $entityForm['actions']['submit']['#value'] = t($this->configuration['entity_type_submit_text']);// Editable submit button value.
        if ($this->configuration['template'] == 'learnmore') {
            $entityForm['actions']['submit']['#value'] = ''.$entityForm['actions']['submit']['#value'];
        }
    } else {
        $entityForm = '';
    }
    $entityForm['actions']['preview'] = '';

    $content = [
        'template'     => [
            '#type'       => 'container',
            '#attributes' => [
                'class'      => [$this->configuration['template']],
            ],
            'header'  => [
                '#type'  => 'html_tag',
                '#tag'   => 'h5',
                '#value' => $this->configuration['label'],
            ],
            'form' => $entityForm,
        ],
    ];

    return $content;
}

Which renders the form. But I'm setting the submit button text as specified by the user like so

$entityForm['actions']['submit']['#value'] = t($this->configuration['entity_type_submit_text']);

And I want to add an icon inside the button before the text like so

$entityForm['actions']['submit']['#value'] = ''.$entityForm['actions']['submit']['#value'];

The issue is when it renders the button it includes the html tags so the actual submit button text is

  Submit Button Text

It displays the html tags instead of rendering the actual icon.
Is there a way to allow html tags inside of a submit button on a form?